Skip to content

Commit

Permalink
test : compare objects not identical by reference
Browse files Browse the repository at this point in the history
PR-URL: #24189
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
meelie authored and MylesBorins committed Dec 26, 2018
1 parent 4e21eb4 commit 1ec6923
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,27 @@ assert.throws(() => assert.deepStrictEqual(new Boolean(true), {}),
);
}

// Strict equal with identical objects that are not identical
// by reference and longer than 30 elements
// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
{
const a = {};
const b = {};
for (let i = 0; i < 35; i++) {
a[`symbol${i}`] = Symbol();
b[`symbol${i}`] = Symbol();
}

assert.throws(
() => assert.deepStrictEqual(a, b),
{
code: 'ERR_ASSERTION',
name: 'AssertionError [ERR_ASSERTION]',
message: /\.\.\./g
}
);
}

// Basic valueOf check.
{
const a = new String(1);
Expand Down

0 comments on commit 1ec6923

Please sign in to comment.