-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
43 lines (33 loc) · 1.08 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
'use strict';
var test = require('ava');
var simpleType = require('./');
test('typeof String should work', function (t) {
t.assert(simpleType('test') === 'string');
});
test('typeof Array should work', function (t) {
t.assert(simpleType([1,2,3]) === 'array');
});
test('typeof Object should work', function (t) {
t.assert(simpleType({name: 'ruan', age: 12}) === 'object');
});
test('typeof Number should work', function (t) {
t.assert(simpleType(12) === 'number');
});
test('typeof Boolean should work', function (t) {
t.assert(simpleType(false) === 'boolean');
});
test('typeof Null should work', function (t) {
t.assert(simpleType(null) === 'null');
});
test('typeof Function should work', function (t) {
t.assert(simpleType(function() {}) === 'function');
});
test('typeof RegExp should work', function (t) {
t.assert(simpleType(/$a/g) === 'regexp');
});
test('typeof Date should work', function (t) {
t.assert(simpleType(new Date()) === 'date');
});
test('typeof Undefined should work', function (t) {
t.assert(simpleType(undefined) === 'undefined');
});