title: Jest: check how many times a mocked module function was called
body: <p>I am using the module waait in my code to allow me to do things like:</p>
  
  <pre><code>import * as wait from 'waait';
  await wait(500);
  </code></pre>
  
  <p>I have created a manual mock:</p>
  
  <pre><code>module.exports = (() =&gt; {
    return Promise.resolve();
  });
  </code></pre>
  
  <p>I then want to have assertions like this in my test:</p>
  
  <pre><code>import * as wait from 'waait';
  expect(wait).toHaveBeenCalledTimes(1);
  expect(wait).toHaveBeenLastCalledWith(1000);
  </code></pre>
  
  <p>When I run that, I get:</p>
  
  <pre><code>expect(jest.fn())[.not].toHaveBeenCalledTimes()
  
  jest.fn() value must be a mock function or spy.
  Received: undefined
  </code></pre>