Skip to content

Commit

Permalink
adds another test for restarting the game
Browse files Browse the repository at this point in the history
  • Loading branch information
vnglst committed Aug 10, 2019
1 parent 93f7d32 commit 6937a8d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/finding-words/__tests__/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,22 @@ it("should render Settings page when cog icon is clicked", async () => {
const heading = getByRole("heading");
expect(heading).toHaveTextContent("TIBO");
});

it("should be possible to restart the game", async () => {
const { getByLabelText, getByText, queryByText } = renderWithRedux(<App />);

const A = getByText("A");
fireEvent.mouseDown(A);
expect(A).toHaveClass("orange");

const button = getByLabelText("New game");

fireEvent.mouseDown(button);

expect(getByText(/New game/)).toBeInTheDocument();

fireEvent.mouseDown(getByText("New game"));

expect(queryByText(/New game/)).not.toBeInTheDocument();
expect(getByText("A")).not.toHaveClass("orange");
});

0 comments on commit 6937a8d

Please sign in to comment.