title: Jest mock function arguments don't match when using immutable data structures
body: <p>When trying to test the arguments passed to the function with Jest's <code>.toHaveBeenCalledWith()</code> method, the test fails if I am treating with immutable data structures using ImmutableJS library. The test fails with the message similar to this:</p>
  
  <pre><code>Expected mock function to have been called with:
    [{"foo": true, "bar": "baz"}]
  But it was called with:
    [{"foo": true, "bar": "baz"}]
  </code></pre>
  
  <p>The test looks similar to this:</p>
  
  <pre><code>const expectedArgs = Map({
    foo: true,
    bar: 'baz'
  });
  
  const foo = jest.fn();
  bar();
  expect(foo).toHaveBeenCalledWith(expectedArgs);
  </code></pre>
  
  <p>And the function similar to this:</p>
  
  <pre><code>const bar = () =&gt; {
    const baz = Map({});
    const bazModified = baz.set('foo', true).set('bar', 'baz');
    foo(bazModified);
  }
  </code></pre>
  
  <p>I realized that if I pass the arguments in this manner everything works fine:</p>
  
  <pre><code>const bar = () =&gt; {
    const baz = Map({
      foo: true,
      bar: 'baz'
    });
    foo(baz);
  }
  </code></pre>
  
  <p>The problem is that this is a big simplification of my function's logic and I have to use .set to construct the object. Does anybody have an idea why the approach with .set is failing to evaluate correctly?</p>