fix(crypto,sleep): register the ECG column for rotation and update the sleep-debt route test

The canonical rotation registry (src/lib/crypto/encrypted-columns.ts) is the
source of truth its guard test cross-checks; add EcgRecording.waveformEncrypted
there (the script already references it) and drop the redundant parallel guard.
Update the sleep/rhythm route test to the v1.19.0 rolling 5-night balance
(nightsCounted 5, debt 300) instead of the old 14-night cumulative sum.
This commit is contained in:
Marc-André Bombeck committed 2026-06-21 13:06:20 +02:00
1 parent c8673786eb
commit a6d9a39c73
3 files changed
+8 -83

No files matched your search

@@ -132,10 +132,12 @@ describe("GET /api/sleep/rhythm", () => {
const res = await callGet(req());
const body = await res.json();
expect(body.data.sleepDebt.state).toBe("ready");
expect(body.data.sleepDebt.nightsCounted).toBe(10);
// v1.19.0 — the rolling balance counts the most recent 5-night window.
expect(body.data.sleepDebt.nightsCounted).toBe(5);
expect(body.data.sleepDebt.nightsUntilReady).toBe(0);
// 10 nights × 60-min deficit = 600 min cumulative debt.
expect(body.data.sleepDebt.debtMinutes).toBe(600);
// 5-night window × 60-min nightly deficit (all short, no catch-up) = 300 min
// running balance.
expect(body.data.sleepDebt.debtMinutes).toBe(300);
expect(body.data.sleepDebt.needMinutes).toBe(420);
});
});