diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-17 20:32:58 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-17 20:32:58 +0900 |
| commit | 2f3583212f470f454a8bd4942a36742be92ad62b (patch) | |
| tree | 521313b18404adcbae7bc6ddf9ab415a1d959e9b /frontend/app/components/SubmitStatusLabel.test.tsx | |
| parent | 602cca615c733c79bc3930f37408a0e71ee40e62 (diff) | |
| download | phperkaigi-2026-albatross-2f3583212f470f454a8bd4942a36742be92ad62b.tar.gz phperkaigi-2026-albatross-2f3583212f470f454a8bd4942a36742be92ad62b.tar.zst phperkaigi-2026-albatross-2f3583212f470f454a8bd4942a36742be92ad62b.zip | |
test(frontend): add comprehensive tests for components, hooks, and state
Add 84 new tests covering Jotai atoms (play/watch state transitions,
game timing, score management), utility functions (calcCodeSize,
checkGameResultKind), UI components (SubmitStatusLabel, LeftTime,
SubmitButton, InputText, BorderedContainerWithCaption,
FoldableBorderedContainerWithCaption, UserIcon, PlayerNameAndIcon),
and the usePageTitle hook.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'frontend/app/components/SubmitStatusLabel.test.tsx')
| -rw-r--r-- | frontend/app/components/SubmitStatusLabel.test.tsx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/frontend/app/components/SubmitStatusLabel.test.tsx b/frontend/app/components/SubmitStatusLabel.test.tsx new file mode 100644 index 0000000..cdedf9e --- /dev/null +++ b/frontend/app/components/SubmitStatusLabel.test.tsx @@ -0,0 +1,52 @@ +/** + * @vitest-environment jsdom + */ +import { cleanup, render, screen } from "@testing-library/react"; +import { afterEach, describe, expect, test } from "vitest"; +import SubmitStatusLabel from "./SubmitStatusLabel"; + +afterEach(() => { + cleanup(); +}); + +describe("SubmitStatusLabel", () => { + test("renders '提出待ち' for none status", () => { + render(<SubmitStatusLabel status="none" />); + expect(screen.getByText("提出待ち")).toBeDefined(); + }); + + test("renders '実行中...' for running status", () => { + render(<SubmitStatusLabel status="running" />); + expect(screen.getByText("実行中...")).toBeDefined(); + }); + + test("renders '成功' for success status", () => { + render(<SubmitStatusLabel status="success" />); + expect(screen.getByText("成功")).toBeDefined(); + }); + + test("renders 'テスト失敗' for wrong_answer status", () => { + render(<SubmitStatusLabel status="wrong_answer" />); + expect(screen.getByText("テスト失敗")).toBeDefined(); + }); + + test("renders '時間切れ' for timeout status", () => { + render(<SubmitStatusLabel status="timeout" />); + expect(screen.getByText("時間切れ")).toBeDefined(); + }); + + test("renders 'コンパイルエラー' for compile_error status", () => { + render(<SubmitStatusLabel status="compile_error" />); + expect(screen.getByText("コンパイルエラー")).toBeDefined(); + }); + + test("renders '実行時エラー' for runtime_error status", () => { + render(<SubmitStatusLabel status="runtime_error" />); + expect(screen.getByText("実行時エラー")).toBeDefined(); + }); + + test("renders '!内部エラー!' for internal_error status", () => { + render(<SubmitStatusLabel status="internal_error" />); + expect(screen.getByText("!内部エラー!")).toBeDefined(); + }); +}); |
