Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Faisal
Last active March 20, 2023 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mohammad-Faisal/f5bef01454c89bd592396f77d7561c10 to your computer and use it in GitHub Desktop.
Save Mohammad-Faisal/f5bef01454c89bd592396f77d7561c10 to your computer and use it in GitHub Desktop.
it('Test navigation' , () => {
const ui = renderConnected(
<>
<FirstPage />
<Route path="/second-page">Second Page</Route>
</>,
{ initialState }
);
expect(screen.queryByText('Second Page')).toBeNull();
expect(screen.getByText(/First Page/)).toBeDefined();
// do the action
const button = utils.getByText(/Submit/);
fireEvent.click(button);
// the navigation should occur at this point and we should be on the second page
expect(screen.getByText(/Second Page/)).toBeDefined();
expect(screen.queryByText(/First Page/)).toBeNull();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment