forked from inspirehep/inspirehep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
35 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React from 'react'; | ||
import { render, fireEvent, waitFor } from '@testing-library/react'; | ||
import "@testing-library/jest-dom/extend-expect"; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { Provider } from 'react-redux'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
|
@@ -24,17 +24,17 @@ describe('SignUpPageContainer', () => { | |
); | ||
|
||
const emailInput = getByTestId('email'); | ||
await waitFor(() => fireEvent.change(emailInput, { target: { value: '[email protected]' } })); | ||
await waitFor(() => | ||
fireEvent.change(emailInput, { target: { value: '[email protected]' } }) | ||
); | ||
const submitButton = getByTestId('submit'); | ||
await waitFor(() => userEvent.click(submitButton)); | ||
|
||
const expectedActions = [ | ||
{ | ||
type: USER_SIGN_UP_REQUEST, | ||
}, | ||
]; | ||
const expectedActions = { | ||
type: USER_SIGN_UP_REQUEST, | ||
}; | ||
|
||
await waitFor(() => expect(store.getActions()).toEqual(expectedActions)); | ||
await waitFor(() => expect(store.getActions()[0]).toEqual(expectedActions)); | ||
}); | ||
|
||
it('passes errors, onSubmit, and loading from the state', () => { | ||
|
@@ -47,13 +47,14 @@ describe('SignUpPageContainer', () => { | |
}), | ||
}); | ||
|
||
const { getByTestId } = render( | ||
const { getByTestId, getByText } = render( | ||
<Provider store={store}> | ||
<SignUpPageContainer /> | ||
</Provider> | ||
); | ||
|
||
expect(getByTestId('This is an error')).toBeInTheDocument(); | ||
expect(getByTestId('true')).toBeInTheDocument(); | ||
expect(getByTestId('error')).toBeInTheDocument(); | ||
expect(getByText('This is an error')).toBeInTheDocument(); | ||
expect(getByTestId('loading')).toBeInTheDocument(); | ||
}); | ||
}); |