Skip to content

Immutable.Map comparison with not the same key order #4618

@davidfou

Description

@davidfou

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Comparison between to identical Immutable.Map() but declared without the same key order fails.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?
All the specs on this example should pass.

describe('comparison with Immitable.Map', () => {
  const map1 = Immutable.Map({ a: 1, b: 2 });
  const map2 = Immutable.Map({ b: 2, a: 1 });
  
  it('should ignore key order with Immutable.is', () => {
    expect(Immutable.is(map1, map2)).toBe(true);
  });
  
  it('should ignore key order with Jest', () => {
    expect(map1).toEqual(map2);
  });
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions