Skip to content

Commit

Permalink
test(NODE-3307): unified runner does not assert identical keys (#2867)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jun 29, 2021
1 parent 621677a commit 558182f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/functional/unified-spec-runner/match.ts
Expand Up @@ -134,10 +134,14 @@ export function resultCheck(

if (depth > 1) {
expect(actual, `Expected actual to exist at ${path.join('')}`).to.exist;
const actualKeys = Object.keys(actual);
const expectedKeys = Object.keys(expected);
// Don't check for full key set equality because some of the actual keys
// might be e.g. $$unsetOrMatches, which can be omitted.
expect(
Object.keys(actual),
`[${Object.keys(actual)}] length !== [${Object.keys(expected)}]`
).to.have.lengthOf(Object.keys(expected).length);
actualKeys.filter(key => !expectedKeys.includes(key)),
`[${Object.keys(actual)}] has more than the expected keys: [${Object.keys(expected)}]`
).to.have.lengthOf(0);
}

for (const [key, value] of expectedEntries) {
Expand Down

0 comments on commit 558182f

Please sign in to comment.