-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtest.js
More file actions
25 lines (22 loc) · 707 Bytes
/
test.js
File metadata and controls
25 lines (22 loc) · 707 Bytes
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
import assert from 'assert';
import isObject from './index.js';
it('should be true when the value is an object.', function() {
assert(isObject({}));
assert(isObject(Object.create({})));
assert(isObject(Object.create(Object.prototype)));
assert(isObject(Object.create(null)));
assert(isObject(/foo/));
function Foo() {}
assert(isObject(new Foo));
assert(isObject(new Foo()));
});
it('should be false when the value is not an object.', function() {
assert(!isObject('whatever'));
assert(!isObject(1));
assert(!isObject(function() {}));
assert(!isObject([]));
assert(!isObject(['foo', 'bar']));
assert(!isObject());
assert(!isObject(undefined));
assert(!isObject(null));
});