Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions test/tools/unified-spec-runner/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,16 @@ export function resultCheck(
return;
}

if (typeof actual !== 'object') {
expect.fail('Expected actual value to be an object');
}
expect(
actual,
`Expected actual (${inspect(actual)}) to be an ${Array.isArray(expected) ? 'array' : 'object'} at: ${path.join('')}`
).to.satisfy(actual =>
Array.isArray(expected) ? Array.isArray(actual) : typeof actual === 'object'
);

const expectedEntries = Object.entries(expected);

if (Array.isArray(expected)) {
if (!Array.isArray(actual)) {
expect.fail(
`expected value at ${path.join('.')} to be an array, but received ${inspect(actual)}`
);
}
for (const [index, value] of expectedEntries) {
path.push(`[${index}]`);
checkNestedDocuments(index, value, checkExtraKeys);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tools/unified_spec_runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Unified Spec Runner', function () {

expect(() => resultCheckSpy(actual, expected, entitiesMap, [])).to.throw(
AssertionError,
/Expected actual value to be an object/
/to be an object/
);
});
});
Expand Down