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]>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import {
|
|
backupTier,
|
|
retainBackups,
|
|
} from "../src/client/state/reader/backups.ts";
|
|
|
|
const now = Date.parse("2026-10-17T12:00:00.000Z");
|
|
const daysAgo = (d: number) => new Date(now - d * 86_400_000).toISOString();
|
|
|
|
test("a snapshot's tier matches the window that retains it", () => {
|
|
expect(backupTier(daysAgo(0), now)).toBe("daily");
|
|
expect(backupTier(daysAgo(6), now)).toBe("daily");
|
|
expect(backupTier(daysAgo(8), now)).toBe("weekly");
|
|
expect(backupTier(daysAgo(33), now)).toBe("weekly");
|
|
expect(backupTier(daysAgo(40), now)).toBe("monthly");
|
|
// Everything retained falls in one of the three.
|
|
const kept = retainBackups(
|
|
Array.from({ length: 200 }, (_, i) => ({
|
|
id: String(i),
|
|
at: daysAgo(i),
|
|
payload: {},
|
|
})),
|
|
now,
|
|
);
|
|
const tiers = kept.map((s) => backupTier(s.at, now));
|
|
expect(tiers.filter((t) => t === "daily").length).toBe(7);
|
|
expect(tiers.filter((t) => t === "weekly").length).toBe(4);
|
|
expect(tiers.filter((t) => t === "monthly").length).toBe(6);
|
|
});
|