Last active
August 2, 2019 21:28
-
-
Save yanmendes/14e110a51e2616aa1a43af954a2bb89c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
it('should print a success message and redirect on a successful submission', async () => { | |
const Routes = () => | |
<> | |
<Route path='/' exact component={App} /> | |
<Route path='/success' exact component={Success} /> | |
</> | |
const { | |
getByLabelText, | |
getByText, | |
findByText, | |
history | |
} = renderWithReduxAndRouter(<Routes />) | |
const password = '123456' | |
const email = '[email protected]' | |
fireEvent.input(getByLabelText('Email'), setValue(email)) | |
fireEvent.input(getByLabelText('Password'), setValue(password)) | |
fireEvent.input(getByLabelText('Confirm your password'), setValue(password)) | |
await fireEvent.click(getByText('Submit')) | |
const successMessage = await findByText(/Form sent successfully/) | |
expect(successMessage).toBeVisible() | |
expect(history.entries.pop().pathname).toBe('/success') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment