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
  • Loading branch information
ljharb committed Dec 1, 2019
1 parent d7b8ae7 commit 66a3dc4
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 @@ -1042,6 +1042,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 66a3dc4

Please sign in to comment.