Files
gacha-event-tracker/test/reader-aliases.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

32 lines
1.4 KiB
TypeScript

import { expect, test } from "bun:test";
import { migrateLegacy } from "../src/client/state/reader/migration.ts";
import { applyReaderAliases } from "../src/client/state/reader/aliases.ts";
const at = "2026-10-16T12:00:00.000Z";
test("retired and merged event ids carry progress and ticks in every account/revision", () => {
const s = migrateLegacy({}, ["genshin"], at, () => "account:one");
s.data["account:one"]!.progress.old = { status: "done", at };
s.data["account:one"]!.daily.initial = { old: { days: ["2026-10-16"], at } };
const next = applyReaderAliases(s, { old: "new" });
expect(next.data["account:one"]?.progress.new).toHaveProperty(
"status",
"done",
);
expect(next.data["account:one"]?.progress.old).toBeUndefined();
expect(next.data["account:one"]?.daily.initial?.new).toHaveProperty("days", [
"2026-10-16",
]);
expect(applyReaderAliases(next, { old: "new" })).toBe(next);
});
test("aliases carry amount history and durable event snapshots", () => {
const s = migrateLegacy({}, ["genshin"], at, () => "account:one");
s.data["account:one"]!.amounts.initial = {
old: { "2026-10-16": { value: 7, at } },
};
const next = applyReaderAliases(s, { old: "new" });
expect(next.data["account:one"]?.amounts.initial?.new).toHaveProperty(
"2026-10-16",
{ value: 7, at },
);
expect(next.data["account:one"]?.amounts.initial?.old).toBeUndefined();
});