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

61 lines
1.8 KiB
TypeScript

import { expect, test } from "bun:test";
import { setupReader } from "../src/client/state/reader/onboarding.ts";
import { migrateLegacy } from "../src/client/state/reader/migration.ts";
const at = "2026-10-16T12:00:00.000Z";
test("new-reader setup is events-only and remembers unsupported cycle intent", () => {
const state = migrateLegacy({}, ["genshin"], at, () => "account:one");
const next = setupReader(
{
region: "asia",
interface: "relaxed",
theme: "dark",
scheme: "slate",
timezone: null,
games: ["genshin"],
tracking: {
genshin: {
events: true,
dailies: false,
weeklyMonthly: false,
cycles: true,
},
},
showUpcoming: false,
view: "timeline",
},
state,
at,
() => "account:two",
);
const a = next.accounts["account:one"]!;
expect(a.region).toBe("asia");
expect(a.intent.cycles).toBe(true);
expect(a.routines["dailies:genshin"]?.followed).toBe(false);
expect(next.prefs.onboarded).toBe(true);
expect(next.prefs.view).toBe("timeline");
expect(next.prefs.showUpcoming).toBe(false);
});
test("the timeline design is saved only when the reader starts on Timeline", () => {
const state = migrateLegacy({}, ["genshin"], at, () => "account:one");
const draft = {
region: "europe" as const,
interface: "structured" as const,
theme: "dark" as const,
scheme: "slate",
timezone: null,
games: ["genshin"],
tracking: {},
showUpcoming: false,
view: "timeline" as const,
timelineLook: "classic" as const,
};
const mint = () => "account:two";
expect(setupReader(draft, state, at, mint).prefs.timelineLook).toBe(
"classic",
);
expect(
setupReader({ ...draft, view: "soon" }, state, at, mint).prefs.timelineLook,
).toBeUndefined();
});