deno_std
deno_std copied to clipboard
assertObjectMatch doesn't print whole object in assertion error
Describe the bug assertObjectMatch doesn't print whole object in assertion error
Steps to Reproduce
import { assertObjectMatch } from "https://deno.land/[email protected]/assert/mod.ts";
const x = {
command: 'error',
payload: {
message: 'NodeNotFound',
},
protocol: 'graph',
};
const y = {
protocol: 'graph',
command: 'addgroup',
payload: {
graph: 'foo',
metadata: {
description: 'foo',
},
name: 'somegroup',
nodes: [
'somenode',
'someothernode',
]
}
};
assertObjectMatch(x, y);
error: AssertionError: Values are not equal.
[Diff] Actual / Expected
{
+ command: "addgroup",
+ payload: {
+ graph: "foo",
+ metadata: {
+ description: "foo",
+ },
+ name: "somegroup",
+ nodes: {
+ "0": "somenode",
+ "1": "someothernode",
+ },
+ },
- command: "error",
- payload: {},
protocol: "graph",
}
throw new AssertionError(message);
^
at assertEquals (https://deno.land/[email protected]/assert/assert_equals.ts:53:9)
at assertObjectMatch (https://deno.land/[email protected]/assert/assert_object_match.ts:83:10)
at assertOutputMatchesExpected (file:///home/tom/Code/code9/deno/c9-fbp/src/runtime.test.ts:101:3)
at eventLoopTick (ext:core/01_core.js:183:11)
at async Object.<anonymous> (file:///home/tom/Code/code9/deno/c9-fbp/src/runtime.test.ts:522:13)
at async Function.runTest (https://deno.land/[email protected]/testing/_test_suite.ts:358:7)
at async Function.runTest (https://deno.land/[email protected]/testing/_test_suite.ts:346:9)
at async Function.runTest (https://deno.land/[email protected]/testing/_test_suite.ts:346:9)
at async Function.runTest (https://deno.land/[email protected]/testing/_test_suite.ts:346:9)
at async Function.runTest (https://deno.land/[email protected]/testing/_test_suite.ts:346:9)
Expected behavior Payload in the error to be filled.
Environment
- OS: NixOS
- deno version: deno 1.37.2 (release, x86_64-unknown-linux-gnu) v8 11.8.172.13 typescript 5.2.2
- std version: 0.204.0
Thanks for reporting.
payload: {
},
part looks missing the property message: 'NodeNotFound'
Yes, it will miss any property :)