diff --git a/src/features/about/aboutPage.test.tsx b/src/features/about/aboutPage.test.tsx
index 35edc2b..0f34930 100644
--- a/src/features/about/aboutPage.test.tsx
+++ b/src/features/about/aboutPage.test.tsx
@@ -1,19 +1,26 @@
import { describe, expect, test } from "bun:test";
import type { AppVariables } from "@shared/appVariables.ts";
+import { pageRoutes } from "@shared/pageRoutes.ts";
import { Hono } from "hono";
import { aboutPage } from "./aboutPage.tsx";
describe("aboutPage", () => {
test("renders the about page HTML", async () => {
- const app = new Hono<{ Variables: AppVariables }>().route("/", aboutPage);
+ const app = new Hono<{ Variables: AppVariables }>().route(
+ pageRoutes.ABOUT,
+ aboutPage,
+ );
- const response = await app.fetch(new Request("http://localhost/"));
+ const response = await app.fetch(
+ new Request(`http://localhost${pageRoutes.ABOUT}`),
+ );
const html = await response.text();
expect(response.status).toBe(200);
expect(html).toContain("
ToDo");
expect(html).toContain("About
");
- expect(html).toContain('Home');
+ expect(html).toContain('Login');
+ expect(html).not.toContain('About');
expect(html).toContain("Powered By
");
expect(html).toContain("Name | ");
expect(html).toContain("Link | ");
diff --git a/src/features/about/aboutPage.tsx b/src/features/about/aboutPage.tsx
index df31707..5c8d4b2 100644
--- a/src/features/about/aboutPage.tsx
+++ b/src/features/about/aboutPage.tsx
@@ -6,7 +6,7 @@ export const aboutPage = new Hono<{ Variables: AppVariables }>().get(
"/",
(c) => {
return c.html(
-
+
About
Powered By
diff --git a/src/features/add-todo/addToDoPage.test.tsx b/src/features/add-todo/addToDoPage.test.tsx
index 0dbe8ad..3f55213 100644
--- a/src/features/add-todo/addToDoPage.test.tsx
+++ b/src/features/add-todo/addToDoPage.test.tsx
@@ -14,9 +14,11 @@ describe("addToDoPage", () => {
});
const app = new Hono<{ Variables: AppVariables }>()
.use("*", createAppConfigMiddleware(appConfig))
- .route("/", addToDoPage);
+ .route(pageRoutes.ADD_TODO, addToDoPage);
- const response = await app.fetch(new Request("http://localhost/"));
+ const response = await app.fetch(
+ new Request(`http://localhost${pageRoutes.ADD_TODO}`),
+ );
expect(response.status).toBe(302);
expect(response.headers.get("Location")).toBe(pageRoutes.LOGIN);
@@ -26,13 +28,17 @@ describe("addToDoPage", () => {
const appConfig = createAppConfig({
JWT_SECRET: "12345678901234567890123456789012",
});
- const token = await sign({ sub: "admin" }, appConfig.jwt.secret, "HS256");
+ const token = await sign(
+ { sub: "1234", preferred_username: "admin" },
+ appConfig.jwt.secret,
+ "HS256",
+ );
const app = new Hono<{ Variables: AppVariables }>()
.use("*", createAppConfigMiddleware(appConfig))
- .route("/", addToDoPage);
+ .route(pageRoutes.ADD_TODO, addToDoPage);
const response = await app.fetch(
- new Request("http://localhost/", {
+ new Request(`http://localhost${pageRoutes.ADD_TODO}`, {
headers: {
Cookie: `${appConfig.jwt.cookieName}=${token}`,
},
@@ -41,6 +47,12 @@ describe("addToDoPage", () => {
const html = await response.text();
expect(response.status).toBe(200);
- expect(html).toContain("Add ToDo");
+ expect(html).toContain("ToDo");
+ expect(html).toContain("Add ToDo
");
+ expect(html).toContain('Home');
+ expect(html).not.toContain('Add');
+ expect(html).toContain('About');
+ expect(html).toContain("admin");
+ expect(html).toContain('