GeezerVison is showing github.com — test: improve test coverage for comparisons · nodejs/node@c145690
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js +9-5Lines changed: 9 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -367,6 +367,7 @@ assertOnlyDeepEqual( | 367 | 367 | new Map([[null, undefined]]), | 368 | 368 | new Map([[undefined, null]]) | 369 | 369 | ); | | 370 | + | 370 | 371 | assertOnlyDeepEqual( | 371 | 372 | new Set([null, '']), | 372 | 373 | new Set([undefined, 0]) | @@ -375,6 +376,10 @@ assertNotDeepOrStrict( | 375 | 376 | new Set(['']), | 376 | 377 | new Set(['0']) | 377 | 378 | ); | | 379 | +assertOnlyDeepEqual( | | 380 | + new Map([[1, {}]]), | | 381 | + new Map([[true, {}]]) | | 382 | +); | 378 | 383 |
| 379 | 384 | // GH-6416. Make sure circular refs don't throw. | 380 | 385 | { | @@ -551,13 +556,12 @@ assertOnlyDeepEqual([1, , , 3], [1, , , 3, , , ]); | 551 | 556 | // Handle different error messages | 552 | 557 | { | 553 | 558 | 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')); | 558 | 562 | // TODO: evaluate if this should throw or not. The same applies for RegExp | 559 | 563 | // Date and any object that has the same keys but not the same prototype. | 560 | | - assertOnlyDeepEqual(err1, {}, assert.AssertionError); | | 564 | + assertOnlyDeepEqual(err1, {}); | 561 | 565 | } | 562 | 566 |
| 563 | 567 | // Handle NaN | |
|