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 gireeshpunathil committed Nov 11, 2018
1 parent faa584a commit 5e52e27
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 @@ -915,6 +915,27 @@ assert.deepStrictEqual(obj1, obj2);
);
}

// 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 5e52e27

Please sign in to comment.