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>
---
 .../BorderedContainerWithCaption.test.tsx          | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 frontend/app/components/BorderedContainerWithCaption.test.tsx

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

diff --git a/frontend/app/components/BorderedContainerWithCaption.test.tsx b/frontend/app/components/BorderedContainerWithCaption.test.tsx
new file mode 100644
index 0000000..621dcb3
--- /dev/null
+++ b/frontend/app/components/BorderedContainerWithCaption.test.tsx
@@ -0,0 +1,41 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { cleanup, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test } from "vitest";
+import BorderedContainerWithCaption from "./BorderedContainerWithCaption";
+
+afterEach(() => {
+	cleanup();
+});
+
+describe("BorderedContainerWithCaption", () => {
+	test("renders caption as heading", () => {
+		render(
+			<BorderedContainerWithCaption caption="Test Caption">
+				Content
+			</BorderedContainerWithCaption>,
+		);
+		expect(screen.getByText("Test Caption")).toBeDefined();
+		expect(screen.getByText("Test Caption").tagName).toBe("H2");
+	});
+
+	test("renders children", () => {
+		render(
+			<BorderedContainerWithCaption caption="Title">
+				Child Content
+			</BorderedContainerWithCaption>,
+		);
+		expect(screen.getByText("Child Content")).toBeDefined();
+	});
+
+	test("wraps in bordered container with blue border", () => {
+		render(
+			<BorderedContainerWithCaption caption="Title">
+				Content
+			</BorderedContainerWithCaption>,
+		);
+		const container = screen.getByText("Content").closest(".border-2");
+		expect(container).not.toBeNull();
+	});
+});
-- 
cgit v1.3.1

