title: UnhandledPromiseRejectionWarning:
body: <p>I'm trying to test ReactJs components, where one of them has a method in which it fetches data, the fetch has a promise in it.. So I tried to create a mock file: </p>
  
  <pre><code>  const apiFetch = {
        value() {
          return 42
        },
      }
  
  module.exports = apiFetch
  </code></pre>
  
  <p>then: </p>
  
  <pre><code>const spy = jest.spyOn(apiFetch, 'value')
  
  const isValue = apiFetch.value()
  
  expect(spy).toHaveBeenCalled()
  
  expect(isValue).toBe(42)
  </code></pre>
  
  <p>The test is passing, but this warning is still showing.</p>
  
  <p>I added one more thing: </p>
  
  <pre><code>process.on('UnhandledPromiseRejectionWarning', (e) =&gt; { throw e })
  </code></pre>
  
  <blockquote>
    <p>UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
    error originated either by throwing inside of an async function
    without a catch block, or by rejecting a promise which was not handled
    with .catch(). (rejection id: 188)</p>
  </blockquote>