Skip to content

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

Closed

Description

@Industrial

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

Activity

  1. added
    bug
    on Nov 6, 2023
  2. kt3k commented on Nov 22, 2023

    @kt3k
    Contributor

    Thanks for reporting.

      payload: {
      },
    

    part looks missing the property message: 'NodeNotFound'

  3. added
    help wanted
    on Nov 22, 2023
  4. Industrial commented on Nov 22, 2023

    @Industrial
    ContributorAuthor

    Yes, it will miss any property :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions