Skip to content

Commit 9f60049

Browse files
committed
remove old code
1 parent 35227e2 commit 9f60049

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

src/components/BoardHeaderButton.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ export const BoardHeaderButton = (): JSX.Element => {
2121
image = knook;
2222
} else if (ctx.gameover?.isWin === false) {
2323
image = pawn;
24-
} else if (ctx.gameover) {
25-
return <h2>{ctx.gameover?.error ?? "Error"}</h2>;
2624
}
2725

2826
return (

test/components/BoardHeaderButton.test.tsx

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @vitest-environment jsdom
22
import userEvent from "@testing-library/user-event";
3-
import { render, screen } from "@testing-library/react";
3+
import { render } from "@testing-library/react";
44
import {
55
BoardContext,
66
BoardContextState,
@@ -16,34 +16,6 @@ describe("BoardHeaderButton tests", () => {
1616
vi.clearAllMocks();
1717
});
1818

19-
it("should display error message if gameover is error", async () => {
20-
boardContext.ctx.gameover = { error: "Error Msg" };
21-
22-
render(
23-
<BoardContext.Provider value={boardContext}>
24-
<BoardHeaderButton />
25-
</BoardContext.Provider>
26-
);
27-
28-
const errorMsg = await screen.findByText("Error Msg");
29-
30-
expect(errorMsg).toBeInTheDocument();
31-
});
32-
33-
it("should display 'Error' if no error message provided", async () => {
34-
boardContext.ctx.gameover = {};
35-
36-
render(
37-
<BoardContext.Provider value={boardContext}>
38-
<BoardHeaderButton />
39-
</BoardContext.Provider>
40-
);
41-
42-
const errorMsg = await screen.findByText("Error");
43-
44-
expect(errorMsg).toBeInTheDocument();
45-
});
46-
4719
it.each([
4820
[true, "/src/assets/knook.png"],
4921
[false, "/src/assets/wP.png"],

test/components/Client.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe("Client tests", () => {
8282
it("should handle non-worker puzzle generation error", () => {
8383
console.error = vi.fn();
8484
vi.spyOn(Algs, "generatePuzzleBoard").mockImplementation(() => {
85-
return { cells: [], knownCells: [], error: "mock error" };
85+
return { cells: [], error: "mock error" };
8686
});
8787

8888
render(<Client />, { wrapper: MemoryRouter });

0 commit comments

Comments
 (0)