test: bring fixtures in line with the nap rule and the recovery read

Correlation fixtures wrote minute-long midday sleeps, which the nap
rule now reads as naps; they write nights. The analytics test mocks the
user read the empty recovery reason makes, and the control-byte guard
asserts the size of its sweep.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 06:06:25 +02:00
1 parent c2133203fb
commit 40cf10ba20
5 files changed
+15 -5

No files matched your search

@@ -250,8 +250,9 @@ describe("readCoachCorrelations", () => {
// Next-day sleep falls as today's burden rises (8h baseline − burden).
measurements.push({
type: "SLEEP_DURATION",
value: 8 - burden,
measuredAt: new Date(base + (i + 1) * 86_400_000),
// A night of hours waking at 07:00, not a midday minute-long nap.
value: (8 - burden) * 60,
measuredAt: new Date(base + (i + 1) * 86_400_000 - 5 * 3_600_000),
});
}
@@ -346,8 +347,9 @@ describe("readCoachCorrelations", () => {
// Higher pressure today → shorter sleep tomorrow (a clean negative r).
measurements.push({
type: "SLEEP_DURATION",
value: 8 - swing * 0.5,
measuredAt: new Date(base + (i + 1) * 86_400_000),
// A night of hours waking at 07:00, not a midday minute-long nap.
value: (8 - swing * 0.5) * 60,
measuredAt: new Date(base + (i + 1) * 86_400_000 - 5 * 3_600_000),
});
}
@@ -53,7 +53,10 @@ describe("stripImageMetadata — passthrough", () => {
describe("stripImageMetadata — JPEG", () => {
// SOI + APP0(JFIF) + APP1(Exif w/ GPS) + APP2(ICC) + COM + DQT + SOS + scan.
const soi = Buffer.from([0xff, 0xd8]);
const app0 = jpegSegment(0xe0, Buffer.from("JFIF\0\x01\x01\0\0\x01\0\x01\0\0"));
const app0 = jpegSegment(
0xe0,
Buffer.from("JFIF\0\x01\x01\0\0\x01\0\x01\0\0"),
);
const exifPayload = Buffer.concat([
Buffer.from("Exif\0\0"),
// A recognisable GPS marker string we can assert is gone.
@@ -76,6 +76,7 @@ const sleepScore: SleepScoreValue = {
],
windowNights: 20,
rhythmNights: 20,
rhythmMinNights: 3,
series: [78, 82],
};