Skip to content

Commit

Permalink
Merge pull request #256 from I3uckwheat/hotfix/fix-game-settings-test…
Browse files Browse the repository at this point in the history
…-errors

Fix console warning regarding act in GameSettings tests
  • Loading branch information
wise-king-sullyman authored Apr 24, 2021
2 parents a5ddd13 + 515e0ad commit c8ec910
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/src/components/GameSettings/GameSettings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('GameSettings', () => {
expect(screen.getByText('world')).toBeInTheDocument();
});

it('displays a loading indicator while the pack names are being requested', () => {
it('displays a loading indicator while the pack names are being requested', async () => {
const dispatch = jest.fn();
const onChange = () => {};
const options = {
Expand All @@ -87,10 +87,12 @@ describe('GameSettings', () => {
</HostContext.Provider>,
);

await waitFor(() => expect(window.fetch).toHaveBeenCalledTimes(1));

expect(screen.getByTestId('loader')).toBeInTheDocument();
});

it('dispatches the GET_PACKS action on mount', () => {
it('dispatches the GET_PACKS action on mount', async () => {
const dispatch = jest.fn();
const onChange = () => {};
const options = {
Expand All @@ -104,6 +106,9 @@ describe('GameSettings', () => {
<GameSettings onChange={onChange} options={options} />
</HostContext.Provider>,
);

await waitFor(() => expect(window.fetch).toHaveBeenCalledTimes(1));

expect(dispatch).toHaveBeenCalledWith({ type: 'GET_PACKS', payload: {} });
});

Expand Down

0 comments on commit c8ec910

Please sign in to comment.