Created
April 15, 2020 18:26
-
-
Save sonicoder86/851b3ce3aeccf1c6ba0cd8528ca9788a to your computer and use it in GitHub Desktop.
React Testing Crash Course - part 13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Router } from 'react-router-dom'; | |
import { createMemoryHistory } from 'history'; | |
import { render } from '@testing-library/react'; | |
describe('Routing', () => { | |
it('should display route', () => { | |
const history = createMemoryHistory(); | |
history.push('/modify'); | |
const { getByTestId } = render( | |
<Router history={history}> | |
<App/> | |
</Router> | |
); | |
expect(getByTestId('location-display')).toHaveTextContent('/modify'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment