Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertObjectMatch doesn't print whole object in assertion error #3771

Open
Tracked by #4717
Industrial opened this issue Nov 6, 2023 · 2 comments
Open
Tracked by #4717

assertObjectMatch doesn't print whole object in assertion error #3771

Industrial opened this issue Nov 6, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Industrial
Copy link
Contributor

Industrial commented Nov 6, 2023

Describe the bug
assertObjectMatch doesn't print whole object in assertion error

Steps to Reproduce

import { assertObjectMatch } from "https://deno.land/std@0.207.0/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/std@0.204.0/assert/assert_equals.ts:53:9)
    at assertObjectMatch (https://deno.land/std@0.204.0/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/std@0.204.0/testing/_test_suite.ts:358:7)
    at async Function.runTest (https://deno.land/std@0.204.0/testing/_test_suite.ts:346:9)
    at async Function.runTest (https://deno.land/std@0.204.0/testing/_test_suite.ts:346:9)
    at async Function.runTest (https://deno.land/std@0.204.0/testing/_test_suite.ts:346:9)
    at async Function.runTest (https://deno.land/std@0.204.0/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
@Industrial Industrial added bug Something isn't working needs triage labels Nov 6, 2023
@kt3k kt3k removed the needs triage label Nov 22, 2023
@kt3k
Copy link
Member

kt3k commented Nov 22, 2023

Thanks for reporting.

  payload: {
  },

part looks missing the property message: 'NodeNotFound'

@kt3k kt3k added the help wanted Extra attention is needed label Nov 22, 2023
@Industrial
Copy link
Contributor Author

Yes, it will miss any property :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants