title: Expected mock function to have been called with. But it was not called. Jest
body: <p>I have the following function that I want to test with <code>jest</code>.</p>
  
  <pre><code>import * as pointsAwardingApi from '../api/pointsAwardingApi';
  export function awardPoints(pointsAwarding) {
    return function (dispatch) {
      return new Promise((resolve, reject) =&gt; {
        pointsAwardingApi.awardPoints(pointsAwarding);
      });
    };
  }
  </code></pre>
  
  <p>Then, I created the following test.</p>
  
  <pre><code>import * as pointsAwardingApi from '../../../src/api/pointsAwardingApi';
  it("should call award points api", () =&gt; {
    //given
    pointsAwardingApi.awardPoints = jest.fn();
    let dispatcher = pointsAwardingActions.awardPoints({phone: '555'});
  
    //when
    dispatcher(mockedDispatch);
  
    //then
    expect(pointsAwardingApi.awardPoints).toBeCalledWith({phone: '555'});
  });
  </code></pre>
  
  <p>However, when I run the test I get the following error.</p>
  
  <pre><code>expect(jest.fn()).toBeCalledWith(expected)
  Expected mock function to have been called with: [{"phone": "555"}]
  But it was not called.
  </code></pre>
  
  <p>I guess this is a problem with the <code>Promise</code> but I cannot figure out how to fix it.</p>