mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Add isFunction and isStream helpers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var utils = require('../../../lib/utils');
|
||||
var Stream = require('stream');
|
||||
|
||||
describe('utils::isX', function () {
|
||||
it('should validate Array', function () {
|
||||
@@ -67,5 +68,14 @@ describe('utils::isX', function () {
|
||||
expect(utils.isDate(new Date())).toEqual(true);
|
||||
expect(utils.isDate(Date.now())).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('should validate Function', function () {
|
||||
expect(utils.isFunction(function () {})).toEqual(true);
|
||||
expect(utils.isFunction('function')).toEqual(false);
|
||||
});
|
||||
|
||||
it('should validate Stream', function () {
|
||||
expect(utils.isStream(new Stream.Readable())).toEqual(true);
|
||||
expect(utils.isStream({ foo: 'bar' })).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user