-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
52 lines (45 loc) · 1.16 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*!
* is-kindof <https://github.com/tunnckoCore/is-kindof>
*
* Copyright (c) Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
var test = require('mukla')
var is = require('./index')
var through2 = require('through2')
var keys = Object.keys(is)
var actual = {
'array': [1, 2],
'boolean': true,
'buffer': new Buffer('foo'),
'date': new Date(),
'error': new Error('foo'),
'function': function noop () {},
'generator': (function * () { yield 42 })(),
'generatorfunction': function * () {},
'map': new Map(),
'null': null,
'number': 123,
'object': { a: 'b' },
'promise': Promise.resolve(123),
'regexp': new RegExp('aa'),
'set': new Set(),
'stream': through2(),
'string': 'fooo',
'symbol': Symbol(),
'undefined': undefined,
'weakmap': new WeakMap(),
'weakset': new WeakSet()
}
test('should export >=22 methods', function (done) {
test.ok(keys.length > 21)
done()
})
Object.keys(actual).forEach(function (name) {
test('is.' + name + '(val) work', function (done) {
test.ok(is[name](actual[name]), name + ' should work')
done()
}, true)
})