Skip to content

Commit

Permalink
test, util: refactor isObject in test-util
Browse files Browse the repository at this point in the history
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 Aug 2, 2019
1 parent 0b6a84a commit 84efadf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84efadf

Please sign in to comment.