Skip to content

Commit 558182f

Browse files
authored
test(NODE-3307): unified runner does not assert identical keys (#2867)
1 parent 621677a commit 558182f

File tree

1 file changed

+7
-3
lines changed
  • test/functional/unified-spec-runner

1 file changed

+7
-3
lines changed

test/functional/unified-spec-runner/match.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,14 @@ export function resultCheck(
134134

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

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

0 commit comments

Comments
 (0)