mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
test: date fixtures that feed a clock-relative window relative to now
A fixture dated near the day it was written passes until the date slides out of a window the route counts back from the clock. Five did: a snooze until a fixed date that becomes the past in January, a prognosis read against the wall clock over days seeded at a fixed date, sleep rows and a weight streak read through windows that end now, and a sync token that would expire on a fixed date. The e2e mood heatmap mock and a timeline URL are dated from today as well. A guard scans the integration and e2e trees for near-now absolute dates within reach of a window parameter, with an allowlist for files whose windows are fixed on both ends.
This commit is contained in:
1 parent
73c4dda224
commit
7be05608f8
8 files changed
+263
-15
No files matched your search
@@ -23,13 +23,21 @@ function correlation(r: number, strength: string, n: number) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A calendar day this many days back, so the heatmap cells stay inside its
|
||||
* 90-day window whenever the suite runs.
|
||||
*/
|
||||
function dayKeyDaysAgo(days: number): string {
|
||||
return new Date(Date.now() - days * 86_400_000).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
const MOOD_INSIGHTS_PAYLOAD = {
|
||||
summary: { totalEntries: 269, inTargetPct: 62 },
|
||||
heatmap: {
|
||||
windowDays: 90,
|
||||
cells: [
|
||||
{ date: "2026-07-01", score: 4, samples: 2 },
|
||||
{ date: "2026-07-02", score: 3, samples: 1 },
|
||||
{ date: dayKeyDaysAgo(14), score: 4, samples: 2 },
|
||||
{ date: dayKeyDaysAgo(13), score: 3, samples: 1 },
|
||||
],
|
||||
},
|
||||
distribution: [],
|
||||
|
||||
Reference in new issue
Block a user