Skip to content

Commit c145690

Browse files
BridgeARrvagg
authored andcommitted
test: improve test coverage for comparisons
PR-URL: #22212 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f1c22ea commit c145690

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/parallel/test-assert-deep.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ assertOnlyDeepEqual(
367367
new Map([[null, undefined]]),
368368
new Map([[undefined, null]])
369369
);
370+
370371
assertOnlyDeepEqual(
371372
new Set([null, '']),
372373
new Set([undefined, 0])
@@ -375,6 +376,10 @@ assertNotDeepOrStrict(
375376
new Set(['']),
376377
new Set(['0'])
377378
);
379+
assertOnlyDeepEqual(
380+
new Map([[1, {}]]),
381+
new Map([[true, {}]])
382+
);
378383

379384
// GH-6416. Make sure circular refs don't throw.
380385
{
@@ -551,13 +556,12 @@ assertOnlyDeepEqual([1, , , 3], [1, , , 3, , , ]);
551556
// Handle different error messages
552557
{
553558
const err1 = new Error('foo1');
554-
const err2 = new Error('foo2');
555-
const err3 = new TypeError('foo1');
556-
assertNotDeepOrStrict(err1, err2, assert.AssertionError);
557-
assertNotDeepOrStrict(err1, err3, assert.AssertionError);
559+
assertNotDeepOrStrict(err1, new Error('foo2'), assert.AssertionError);
560+
assertNotDeepOrStrict(err1, new TypeError('foo1'), assert.AssertionError);
561+
assertDeepAndStrictEqual(err1, new Error('foo1'));
558562
// TODO: evaluate if this should throw or not. The same applies for RegExp
559563
// Date and any object that has the same keys but not the same prototype.
560-
assertOnlyDeepEqual(err1, {}, assert.AssertionError);
564+
assertOnlyDeepEqual(err1, {});
561565
}
562566

563567
// Handle NaN

0 commit comments

Comments
 (0)