From 17ba3c603e4c522ccca282f6786fff2e0b3f4f6e Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sat, 6 Dec 2025 18:01:31 +0900
Subject: feat(client): setup routing with wouter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add wouter router with pages for home, login, register, and 404.
Include tests for all routes using @testing-library/react.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
---
 src/client/App.test.tsx | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 src/client/App.test.tsx

(limited to 'src/client/App.test.tsx')

diff --git a/src/client/App.test.tsx b/src/client/App.test.tsx
new file mode 100644
index 0000000..cd448bf
--- /dev/null
+++ b/src/client/App.test.tsx
@@ -0,0 +1,47 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { cleanup, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it } from "vitest";
+import { Router } from "wouter";
+import { memoryLocation } from "wouter/memory-location";
+import { App } from "./App";
+
+function renderWithRouter(path: string) {
+	const { hook } = memoryLocation({ path, static: true });
+	return render(
+		<Router hook={hook}>
+			<App />
+		</Router>,
+	);
+}
+
+afterEach(() => {
+	cleanup();
+});
+
+describe("App routing", () => {
+	it("renders home page at /", () => {
+		renderWithRouter("/");
+		expect(screen.getByRole("heading", { name: "Kioku" })).toBeDefined();
+		expect(screen.getByText("Spaced repetition learning app")).toBeDefined();
+	});
+
+	it("renders login page at /login", () => {
+		renderWithRouter("/login");
+		expect(screen.getByRole("heading", { name: "Login" })).toBeDefined();
+	});
+
+	it("renders register page at /register", () => {
+		renderWithRouter("/register");
+		expect(screen.getByRole("heading", { name: "Register" })).toBeDefined();
+	});
+
+	it("renders 404 page for unknown routes", () => {
+		renderWithRouter("/unknown-route");
+		expect(
+			screen.getByRole("heading", { name: "404 - Not Found" }),
+		).toBeDefined();
+		expect(screen.getByRole("link", { name: "Go to Home" })).toBeDefined();
+	});
+});
-- 
cgit v1.2.3-70-g09d2

