test+a11y: fix mocks/expectations for source-priority + dashboard ids; pair coach-memory spinner with motion-reduce

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.8 committed 2026-06-04 13:12:18 +02:00
1 parent 07c444f938
commit 2994954138
4 files changed
+18 -11

No files matched your search

+5 -4
View File
@@ -70,10 +70,11 @@ const layoutSchema = z.object({
}),
)
.min(1)
// v1.7.0 W1 — raised from 20 to 30 so the full 27-id catalogue PUT
// (web 16 + iOS-only 11) fits with headroom; the enum still bounds
// each id to one of the 27.
.max(30),
// v1.11.2 B5 — raised to 40 so the full catalogue PUT (24 writable +
// 11 iOS-only = 35) fits with headroom after the v1.10 additive
// HealthKit signals became pinnable; the enum still bounds each id to
// one of the catalogue ids.
.max(40),
// v1.4.16 phase B8 — comparison baseline (Vormonat / Vorjahr) rides
// on the layout blob per research §7 Q3 (no Prisma migration). Optional
// so v1.4.15 clients that don't know the field can still PUT.
@@ -172,7 +172,10 @@ export function CoachMemorySection({
disabled={!isAuthenticated || forgetAll.isPending}
>
{forgetAll.isPending ? (
<Loader2 className="size-4 animate-spin" aria-hidden />
<Loader2
className="size-4 animate-spin motion-reduce:animate-none"
aria-hidden
/>
) : (
<Trash2 className="size-4" aria-hidden />
)}
+6 -6
View File
@@ -364,17 +364,17 @@ describe("buildDashboardSnapshot — metricStates (iOS cold-launch seed)", () =>
});
});
describe("buildDashboardSnapshot — layoutCatalogue (27-id round-trip)", () => {
describe("buildDashboardSnapshot — layoutCatalogue (35-id round-trip)", () => {
beforeEach(() => {
probeRollupCoverage.mockResolvedValue(new Map());
isFullyCovered.mockReturnValue(false);
});
it("emits all 27 catalogue ids with visibility + order", async () => {
it("emits all 35 catalogue ids with visibility + order", async () => {
const snap = await buildDashboardSnapshot(fakePrisma, baseUser());
expect(snap.layoutCatalogue).toHaveLength(27);
expect(snap.layoutCatalogue).toHaveLength(35);
const ids = new Set(snap.layoutCatalogue.map((w) => w.id));
expect(ids.size).toBe(27);
expect(ids.size).toBe(35);
// iOS-only ids appended default-invisible.
const hrv = snap.layoutCatalogue.find((w) => w.id === "hrv");
expect(hrv).toBeDefined();
@@ -436,11 +436,11 @@ describe("buildDashboardSnapshot — additive proof", () => {
expect(snap).toHaveProperty("layoutCatalogue");
// The web-consumed `layout` block is the resolved per-user layout —
// NOT replaced by the 27-id catalogue.
// NOT replaced by the 35-id catalogue.
expect(snap.layout).toHaveProperty("version");
expect(Array.isArray(snap.layout.widgets)).toBe(true);
// Resolved layout still carries only server-known widget ids.
expect(snap.layout.widgets.length).toBeLessThanOrEqual(16);
expect(snap.layout.widgets.length).toBeLessThanOrEqual(24);
// tiles shape unchanged.
expect(snap.tiles).toHaveProperty("summaries");
@@ -6,6 +6,9 @@ vi.mock("@/lib/db", () => ({
measurement: {
findMany: (...args: unknown[]) => findMany(...args),
},
// loadUserSourcePriority lazy-loads the source-priority blob; null
// (default findUnique) falls back to the default ladders.
user: { findUnique: vi.fn() },
},
}));