From c3bd65146e95968edf81b70f51823e0f44e701f2 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 3 Aug 2018 20:47:32 +0200 Subject: [PATCH] test: improve test coverage for comparisons PR-URL: https://github.com/nodejs/node/pull/22212 Reviewed-By: Anatoli Papirovski Reviewed-By: Benjamin Gruenbaum Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-assert-deep.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index 08491421f62..12876232ed1 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -372,6 +372,7 @@ assertOnlyDeepEqual( new Map([[null, undefined]]), new Map([[undefined, null]]) ); + assertOnlyDeepEqual( new Set([null, '']), new Set([undefined, 0]) @@ -380,6 +381,10 @@ assertNotDeepOrStrict( new Set(['']), new Set(['0']) ); +assertOnlyDeepEqual( + new Map([[1, {}]]), + new Map([[true, {}]]) +); // GH-6416. Make sure circular refs don't throw. { @@ -556,13 +561,12 @@ assertOnlyDeepEqual([1, , , 3], [1, , , 3, , , ]); // Handle different error messages { const err1 = new Error('foo1'); - const err2 = new Error('foo2'); - const err3 = new TypeError('foo1'); - assertNotDeepOrStrict(err1, err2, assert.AssertionError); - assertNotDeepOrStrict(err1, err3, assert.AssertionError); + assertNotDeepOrStrict(err1, new Error('foo2'), assert.AssertionError); + assertNotDeepOrStrict(err1, new TypeError('foo1'), assert.AssertionError); + assertDeepAndStrictEqual(err1, new Error('foo1')); // TODO: evaluate if this should throw or not. The same applies for RegExp // Date and any object that has the same keys but not the same prototype. - assertOnlyDeepEqual(err1, {}, assert.AssertionError); + assertOnlyDeepEqual(err1, {}); } // Handle NaN