Bring the checks up to date with the trend and range changes

The checks had fallen behind three refactors and had stopped running:
foodTrend became dailyTrend (the sleep trend line), the sleep average
moved into averageDays, and the custom date range replaced chartDays
with chartRange/chartSpan and gave the sentences a window phrase.

They now load the current functions. The window check exercises the
real range picker against stored settings, with a new case for a custom
range in the past. No assertion changed meaning; all 223 pass.
This commit is contained in:
Alexander Heldt committed 2026-10-04 18:23:57 +00:00
1 parent 7b1b0889c6
commit a37474ab82
3 files changed
+57 -31

No files matched your search

+7 -5
View File
@@ -8,12 +8,14 @@ const app = load({
names: [
"ymd", "startOfDay", "EXCLUDED_TYPE", "ALWAYS_COUNTS", "excludedSet",
"excludedDays", "isExcluded", "countedEvents", "spansExcluded",
"pairWindows", "sleepWindows", "sleepMsInRange", "lastEventOfType",
"pairWindows", "sleepWindows", "sleepIntervals", "msInIntervals", "sleepMsInRange",
"lastEventOfType",
"gapsBetween",
],
lets: ["excludedSet"],
// gapsBetween defaults its window to the chart picker; the checks pass it in.
stubs: { chartDays: () => 7 },
// gapsBetween takes its window from the chart range picker (chartSpan); here
// that is the two weeks up to and including the checks' "now" day.
stubs: { chartSpan: () => ({ from: NOW - 14 * 24 * H, to: NOW + 24 * H }) },
});
const H = 3600_000;
@@ -30,7 +32,7 @@ suite("what a marked day takes out of the numbers");
{ id: "c", type: "pee", at: at(20, 9) },
mark(19),
]);
eq(app.gapsBetween(evs, "pee", 14), [],
eq(app.gapsBetween(evs, "pee"), [],
"a gap reaching across a marked day is discarded rather than measured");
}
{
@@ -41,7 +43,7 @@ suite("what a marked day takes out of the numbers");
{ id: "g", type: "pee", at: at(20, 12) },
mark(19),
]);
eq(app.gapsBetween(evs, "pee", 14), [4 * H, 4 * H],
eq(app.gapsBetween(evs, "pee"), [4 * H, 4 * H],
"…while the gaps either side of it survive");
}
{