Created
August 2, 2019 20:39
-
-
Save yanmendes/8500bea5660bd611996195288f6cd5ff 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 an error message in a failed submission', async () => { | |
axios.post.mockRejectedValue('not ok :(') | |
const { getByLabelText, getByText, findByText } = renderWithRedux(<App />) | |
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)) | |
fireEvent.click(getByText('Submit')) | |
const errorMessage = await findByText(/Something went wrong/) | |
expect(errorMessage).toBeVisible() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment