test: final metadata integration sweep — verify all page titles (Task 11)

This commit is contained in:
2026-05-25 19:42:05 +08:00
parent ad7c361d0d
commit 49800c3cc2
+24 -7
View File
@@ -95,25 +95,42 @@ describe("Page Metadata", () => {
describe("Compare layout", () => { describe("Compare layout", () => {
it("exports unique title and description", async () => { it("exports unique title and description", async () => {
try {
const { metadata } = await import("@/app/compare/layout") const { metadata } = await import("@/app/compare/layout")
expect(metadata.title).toBe("Compare Games") expect(metadata.title).toBe("Compare Games")
expect(metadata.description).toBeDefined() expect(metadata.description).toBeDefined()
} catch {
throw new Error("app/compare/layout.tsx not created yet")
}
}) })
}) })
describe("Profile layout", () => { describe("Profile layout", () => {
it("exports unique title and description", async () => { it("exports unique title and description", async () => {
try {
const { metadata } = await import("@/app/profile/layout") const { metadata } = await import("@/app/profile/layout")
expect(metadata.title).toBe("Profile") expect(metadata.title).toBe("Profile")
expect(metadata.description).toBeDefined() expect(metadata.description).toBeDefined()
} catch { })
throw new Error("app/profile/layout.tsx not created yet") })
describe("End-to-end metadata consolidation", () => {
it("all public pages have unique titles", async () => {
const pages = [
{ name: "layout", expected: "DeckyVault - Steam Deck Benchmarks & Settings" },
{ name: "games/page", expected: "Games" },
{ name: "devices/page", expected: "Devices" },
{ name: "compare/layout", expected: "Compare Games" },
]
const titles = new Set<string>()
for (const page of pages) {
const mod = await import(`@/app/${page.name}`)
const actualTitle = mod.metadata.title?.default ?? mod.metadata.title
expect(actualTitle).toBe(page.expected)
const resolvedTitle = page.name === "layout"
? actualTitle
: `${actualTitle} | DeckyVault`
titles.add(resolvedTitle)
} }
expect(titles.has("DeckyVault - Steam Deck Benchmarks & Settings")).toBe(true)
expect(titles.size).toBe(pages.length)
}) })
}) })
}) })