Skip to content

Commit

Permalink
Test use-game hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
zourdyzou committed Aug 9, 2022
1 parent d5ee7ac commit 423ebc4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/modules/GameWithHooks/hooks/use-game/use-game.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { GameLevels, GameSettings } from "@modules/GameSettings";
import { useGame } from "@modules/GameWithHooks/hooks/use-game/index";
import { renderHook } from "@testing-library/react";

const [beginner, ,] = GameLevels;

describe("useGame test cases", function () {
it("should render hooks behaviour", function () {
const { result } = renderHook(useGame);
const { level, isGameOver, isWin, settings, playerField } = result.current;

expect({ level, isGameOver, isWin, settings }).toStrictEqual({
level: beginner,
isGameOver: false,
isWin: false,
settings: GameSettings.beginner,
});
expect(playerField).toHaveLength(9);
});
});

0 comments on commit 423ebc4

Please sign in to comment.