aboutsummaryrefslogtreecommitdiff
path: root/node_modules/is-object/test/index.js
blob: 263d7b39743dad052afd969cc987d8f3ef94e66f (plain)
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
'use strict';

var test = require('tape');

var isObject = require('../index');

test('returns true for objects', function (assert) {
	assert.equal(isObject({}), true);
	assert.equal(isObject([]), true);

	assert.end();
});

test('returns false for null', function (assert) {
	assert.equal(isObject(null), false);

	assert.end();
});

test('returns false for undefined', function (assert) {
	assert.equal(isObject(undefined), false);

	assert.end();
});

test('returns false for booleans', function (assert) {
	assert.equal(isObject(true), false);
	assert.equal(isObject(false), false);

	assert.end();
});

test('returns false for primitives', function (assert) {
	assert.equal(isObject(42), false);
	assert.equal(isObject('foo'), false);

	assert.end();
});

test('returns false for functions', function (assert) {
	assert.equal(isObject(function () {}), false);

	assert.end();
});