title: How do I test redirection with routeChangeStart React/Nextjs app?
body: <p>I want to test the page get redirected after click on div using next/link, I write test file as below but it's not correct and show this error</p>
  
  <blockquote>
    <p>No router instance found.
        You should only use "next/router" inside the client side of your app.</p>
  </blockquote>
  
  <p>this is my code. Thank you so much for your helps</p>
  
  <p><strong>HeaderContainer.tsx</strong></p>
  
  <pre><code>import Link from 'next/link'
  
  &lt;Link href="/notifications"&gt;
      &lt;Bell className="bellTest" /&gt;
  &lt;/Link&gt;
  </code></pre>
  
  <p><strong>test.tsx</strong></p>
  
  <pre><code>import Router from 'next/router';
  import { mount } from 'enzyme';
  
  describe('Test of &lt;HeaderContainer&gt;', () =&gt; {
    const spies: any = {};
  
    beforeEach(() =&gt; {
      spies.routerChangeStart = jest.fn();
      Router.events.on('routeChangeStart', spies.routerChangeStart);
    });
  
    afterEach(() =&gt; {
      Router.events.off('routeChangeStart', spies.routerChangeStart);
    });
  
    test('Test the page redirect after click', async done =&gt; {
      const wrapper = mount(&lt;HeaderComponent /&gt;);
      await wrapper
        .find('.bellTest')
        .at(0)
        .simulate('click');
  
      expect(spies.routerChangeStart).toHaveBeenCalledWith('/notifications');
    });
  });
  </code></pre>