From 329548b92df5eed708d407ce59f5b57d2e8fe738 Mon Sep 17 00:00:00 2001 From: Tomek Wiszniewski Date: Sat, 23 May 2015 23:57:18 +0200 Subject: [PATCH] Specify `isPlainObject` --- tests/isObject.js | 1 + tests/isPlainObject.js | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/isPlainObject.js 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/)); +});