From 3e346e299c93b013f08da5468075dca15226818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 13 Aug 2026 10:25:39 +0200 Subject: [PATCH] test(integration): keep the HR-curve fixture inside the retention horizon The workout session sat on a fixed calendar day, and the pulse-window fallback only reconstructs a curve inside the 90-day dense-intraday retention horizon. On day 91 the fixture aged out and all three curve assertions went red on every branch, ours and main alike. The session day is relative to the test run now, ten days back, which stays inside the horizon forever. --- .../integration/workout-detail-hr-series.test.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/integration/workout-detail-hr-series.test.ts b/tests/integration/workout-detail-hr-series.test.ts index fff801a84..e578ba906 100644 --- a/tests/integration/workout-detail-hr-series.test.ts +++ b/tests/integration/workout-detail-hr-series.test.ts @@ -61,9 +61,18 @@ vi.mock("@/lib/db-compat", () => ({ const { GET } = await import("@/app/api/workouts/[id]/route"); -/** Session window: 07:00 → 07:30 on a fixed day. */ -const STARTED_AT = new Date("2026-05-15T07:00:00.000Z"); -const ENDED_AT = new Date("2026-05-15T07:30:00.000Z"); +/** + * Session window: 07:00 → 07:30 UTC ten days ago. The pulse-window fallback + * only reconstructs a curve inside the dense-intraday retention horizon + * (`DENSE_INTRADAY_RETENTION_DAYS`, 90 days), so the fixture day must stay + * relative to the test run — a fixed calendar date silently aged past the + * horizon and turned every curve assertion red on day 91. + */ +const SESSION_DAY = new Date(Date.now() - 10 * 24 * 60 * 60 * 1000) + .toISOString() + .slice(0, 10); +const STARTED_AT = new Date(`${SESSION_DAY}T07:00:00.000Z`); +const ENDED_AT = new Date(`${SESSION_DAY}T07:30:00.000Z`); const SPAN_SEC = 1800; /**