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]>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { archiveStats } from "../src/client/state/reader/archiveStats.ts";
|
|
import type { ArchiveRecord } from "../src/client/state/reader/schema.ts";
|
|
import { sampleEvent } from "./helpers/reader.ts";
|
|
const at = "2026-10-16T12:00:00.000Z";
|
|
const r = (outcome: ArchiveRecord["outcome"], id: string): ArchiveRecord => ({
|
|
accountId: "account:one",
|
|
event: { ...sampleEvent, id },
|
|
outcome,
|
|
outcomeAt: at,
|
|
resolvedEnd: Date.parse(at),
|
|
clockRevision: "initial",
|
|
progress: {},
|
|
days: ["2026-10-15", "2026-10-16"],
|
|
amounts: {},
|
|
});
|
|
test("ignored outcomes never count as failures; event check-ins are not unique play days", () => {
|
|
const result = archiveStats(
|
|
[r("done", "a"), r("ignored", "b"), r("unfinished", "c")],
|
|
Date.parse(at),
|
|
);
|
|
expect(result.overall.rate).toBe(50);
|
|
expect(result.overall.eligible).toBe(2);
|
|
expect(result.checkIns).toBe(6);
|
|
expect(result.shortfalls).toEqual([]);
|
|
});
|
|
test("empty archives have no fabricated percentages or progress", () => {
|
|
const result = archiveStats([], Date.parse(at));
|
|
expect(result.overall.rate).toBeNull();
|
|
expect(result.currentRun).toBe(0);
|
|
expect(result.bestRun).toBe(0);
|
|
});
|