From 2f3583212f470f454a8bd4942a36742be92ad62b Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Tue, 17 Feb 2026 20:32:58 +0900
Subject: 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>
---
 frontend/app/components/SubmitStatusLabel.test.tsx | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 frontend/app/components/SubmitStatusLabel.test.tsx

(limited to 'frontend/app/components/SubmitStatusLabel.test.tsx')

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();
+	});
+});
-- 
cgit v1.3.1

