Files
gacha-event-tracker/test/adapters/game8-codes.test.ts
T
Lucas WintherandClaude Opus 5.5 50c6e91b00 feat: the redesigned Event Clock
The new reader app replaces the old UI: Checklist with a rail (focus
pills, Next to expire, today's dailies, pinned routines), Timeline in a
new and a classic look, Routines, Archive and a Settings area, in a
Structured (default) and a Relaxed interface. It follows the approved
Round 6 B and Round 7 mockups, corrected screen by screen with the owner.

Reader data moves to a v2 store (gacha-tracker:v2:*). Existing v1 data
is migrated on first load, a recovery copy is written first, and the v1
keys are never removed, so a rollback finds them unchanged. Redeem codes
for Genshin arrive as their own feed.

Also: live's urgency ramp, editable per theme; completion and
section-complete fireworks; a returning-user tour; the design mockups,
specs, plans, reviews and handoff record.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 01:55:16 +02:00

22 lines
793 B
TypeScript

import { expect, test } from "bun:test";
import { parseGame8Codes } from "../../src/ingest/codes/game8.ts";
test("code attributes are order/quote insensitive and duplicate code rows merge", () => {
const row =
"<tr><td><input value='AbC&amp;X' class='a-clipboard__textInput' readonly></td><td>Reward &amp; more</td></tr>";
const html =
"<h3>Latest Redeem Codes</h3><table><tr><th>Redeem Codes</th><th>Rewards</th></tr>" +
row +
row +
"</table><h2>Expired codes</h2>" +
row;
const codes = parseGame8Codes(html, {
game: "genshin",
sourceId: "test",
sourceUrl: "https://example.com",
now: "2026-10-16T12:00:00.000Z",
});
expect(codes).toHaveLength(1);
expect(codes[0]?.code).toBe("AbC&X");
expect(codes[0]?.reward).toBe("Reward & more");
});