diff --git a/tests/isObject.js b/tests/isObject.js index 2c52d18..137e7d9 100644 --- a/tests/isObject.js +++ b/tests/isObject.js @@ -5,6 +5,7 @@ test('#isObject', () => { ok(isObject({})); ok(isObject([])); ok(isObject(/anything else/)); + ok(isObject(Object.create(null))); ok(!isObject(undefined)); ok(!isObject(null)); diff --git a/tests/isPlainObject.js b/tests/isPlainObject.js new file mode 100644 index 0000000..a1f815d --- /dev/null +++ b/tests/isPlainObject.js @@ -0,0 +1,23 @@ +import {ok} from 'assert'; +import isPlainObject from '../isPlainObject'; + +test('#isPlainObject', () => { + ok(isPlainObject({})); + ok(isPlainObject(Object.create(null))); + + ok(!isPlainObject(undefined)); + ok(!isPlainObject(null)); + ok(!isPlainObject(false)); + ok(!isPlainObject(true)); + ok(!isPlainObject('')); + ok(!isPlainObject('1')); + ok(!isPlainObject(0)); + ok(!isPlainObject(1)); + ok(!isPlainObject(NaN)); + ok(!isPlainObject(Infinity)); + ok(!isPlainObject('non-empty string')); + ok(!isPlainObject([])); + ok(!isPlainObject(() => {})); + ok(!isPlainObject(function named() {})); + ok(!isPlainObject(/anything else/)); +});