2
0
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:
Nick Uraltsev
2016-04-12 19:49:12 -07:00
parent 4de17bca09
commit 9e7b1b5993
2 changed files with 33 additions and 1 deletions
+11 -1
View File
@@ -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);
});
});