Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve test coverage for comparisons #22212

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ assertOnlyDeepEqual(
new Map([[null, undefined]]),
new Map([[undefined, null]])
);

assertOnlyDeepEqual(
new Set([null, '']),
new Set([undefined, 0])
Expand All @@ -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.
{
Expand Down Expand Up @@ -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
Expand Down