title: Jest/Enzyme test if page redirects on button click
body: <p>I am writing unit tests with Jest and Enzyme. I have a button on a 404 page which should redirect a user to the websites homepage.  I want to write a test to make sure this button is redirecting a user to the homepage regardless of the URL.  In other words the test should pass if the button click takes a user to the homepage and should not rely on the href.</p>
  
  <p>So far I have the code to click my button which should reroute the user.</p>
  
  <pre><code>it('redirects when HOMEPAGE button is clicked', () =&gt; {
      const wrapper = mount(&lt;PageNotFound /&gt;);
      const link = wrapper.find('#page-not-found-link').first();
      link.simulate('click');
      expect()
  })
  </code></pre>
  
  <p>When the button is clicked we should be routed to <code>&lt;HomePage /&gt;</code> so I have tried adding in:</p>
  
  <pre><code>it('redirects when HOMEPAGE button is clicked', () =&gt; {
      const wrapper = mount(&lt;PageNotFound /&gt;);
      const newComp = mount (&lt;HomePage /&gt;);
      const link = wrapper.find('#page-not-found-link').first();
      const buttonClick = link.simulate('click');
      expect(buttonClick).toEqual(newComp)
  })
  </code></pre>
  
  <p>It seems like I need to compare <code>&lt;HomePage /&gt;</code> with the result of clicking the button but I haven't been able to find a working solution yet.</p>