From c808747b9db653360e166614605b148994378c5b Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Wed, 20 May 2026 02:27:56 +0800 Subject: [PATCH] fix: correct sitemap test count and steamdb version extraction --- app/__tests__/sitemap.test.ts | 5 ++--- lib/steamdb/scrape.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/__tests__/sitemap.test.ts b/app/__tests__/sitemap.test.ts index 9338bad..d57814c 100644 --- a/app/__tests__/sitemap.test.ts +++ b/app/__tests__/sitemap.test.ts @@ -66,7 +66,6 @@ describe("Sitemap Generator (app/sitemap.ts)", () => { vi.clearAllMocks() mockGameRows = [] mockDeviceRows = [] - gamesCallCount = 0 devicesCallCount = 0 }) @@ -80,8 +79,8 @@ describe("Sitemap Generator (app/sitemap.ts)", () => { const result = await mod.default() expect(Array.isArray(result)).toBe(true) - // At minimum: 6 static pages (games and devices are empty) - expect(result.length).toBeGreaterThanOrEqual(6) + // At minimum: 5 static pages (games and devices are empty) + expect(result.length).toBeGreaterThanOrEqual(5) // First entry should be the homepage with priority 1 expect(result[0].url).toContain("deckyvault.xyz") expect(result[0].priority).toBe(1) diff --git a/lib/steamdb/scrape.ts b/lib/steamdb/scrape.ts index 6cc3c22..284c3d1 100644 --- a/lib/steamdb/scrape.ts +++ b/lib/steamdb/scrape.ts @@ -323,6 +323,14 @@ function extractVersionFromTable(html: string): string | null { } } + // Inline element pattern: "Last known name" followed by a or other + // inline tag inside the same cell (e.g. Last known name v1.2.3) + const inlineMatch = html.match(/Last known name[^<]*<[^>]*>([^<]+) 1 && !val.startsWith("http")) return val + } + // Broader: look for "Last known name" anywhere nearby a with content const looseMatch = html.match(/Last known name[^<]*(?:<[^>]+>)*?\s*]*>([^<]+)