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 <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
meelie authored and BridgeAR committed Nov 13, 2018
1 parent 26c625c commit 2593b40
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 2593b40

Please sign in to comment.