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.
This commit is contained in:
Marc-André Bombeck committed 2026-08-13 10:25:39 +02:00
1 parent 499ca2c4b4
commit 3e346e299c
1 file changed
+12 -3
@@ -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;
/**