title: Mock react-dom Jest
body: <p>I'm trying to mock the react-dom module using Jest</p>
  <pre><code>import React from 'react';
  import {configure, shallow } from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  import Link from '../components/DumbComp';
  import { shallowToJson } from 'enzyme-to-json';
  import { render } from 'react-dom';
  
  configure({ adapter: new Adapter() });
  
  jest.mock('react-dom');
  describe('Link',() =&gt;{
  it('should render correctly', ()=&gt;{
  expect(render).toHaveBeenCalledWith(
    &lt;Link title=&quot;mockTitle&quot; url=&quot;mockUrl&quot; /&gt;, 'element-node'
  );
  expect(render).toHaveBeenCalledTimes(1);
  });
  });
  </code></pre>
  <p>When I run the test I get the following error:</p>
  <pre><code>Link › should render correctly
  
  expect(jest.fn()).toHaveBeenCalledWith(expected)
  
  Expected mock function to have been called with:
    [&lt;Link title=&quot;mockTitle&quot; url=&quot;mockUrl&quot; /&gt;, &quot;element-node&quot;]
  But it was not called.
  </code></pre>
  <p>It seems that when I mock the render method it doesn't return anything. How can I correctly mock it?</p>
  <p>I'm using <a href="https://medium.com/wehkamp-techblog/unit-testing-your-react-application-with-jest-and-enzyme-81c5545cee45" rel="nofollow noreferrer">this tutorial</a>, see under the &quot;The art of mocking&quot; section.</p>