Skip to content

Commit

Permalink
test: assert: fix deepStrictEqual comparing a real array and fake array
Browse files Browse the repository at this point in the history
PR-URL: #30743
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
ljharb authored and MylesBorins committed Dec 13, 2019
1 parent 9d1c793 commit 5f42b1f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,21 @@ assert.throws(
assertDeepAndStrictEqual(a, b);
}

// Verify that an array and the equivalent fake array object
// are correctly compared
{
const a = [1, 2, 3];
const o = {
__proto__: Array.prototype,
0: 1,
1: 2,
2: 3,
length: 3,
};
Object.defineProperty(o, 'length', { enumerable: false });
assertNotDeepOrStrict(o, a);
}

// Verify that extra keys will be tested for when using fake arrays.
{
const a = {
Expand Down

0 comments on commit 5f42b1f

Please sign in to comment.