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 <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
ljharb authored and BethGriggs committed Feb 6, 2020
1 parent 7b3e269 commit a22d5e7
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 @@ -1050,6 +1050,21 @@ assert.throws(
assert.deepStrictEqual(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 a22d5e7

Please sign in to comment.