Skip to content
Permalink
Browse files

test, util: refactor isObject in test-util

refactor the test for isObject function including falsy values,
the use of strictEquals and the format actual, expected

PR-URL: #28878
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
RamirezAlex authored and targos committed Jul 27, 2019
1 parent 0b6a84a commit 84efadf26372f146b8d687d98096fdbaaac91aea
Showing with 5 additions and 1 deletion.
  1. +5 −1 test/parallel/test-util.js
@@ -73,7 +73,11 @@ assert.strictEqual(util.isError([]), false);
assert.strictEqual(util.isError(Object.create(Error.prototype)), true);

// isObject
assert.ok(util.isObject({}) === true);
assert.strictEqual(util.isObject({}), true);
assert.strictEqual(util.isObject([]), true);
assert.strictEqual(util.isObject(new Number(3)), true);
assert.strictEqual(util.isObject(Number(4)), false);
assert.strictEqual(util.isObject(1), false);

// isPrimitive
assert.strictEqual(util.isPrimitive({}), false);

0 comments on commit 84efadf

Please sign in to comment.
You can’t perform that action at this time.