test: name the shared glucose factor where the CSV import pinned the old one

Three assertions repeated 18.016 and the product it gave. They were the
reason the two factors could sit in the tree at once looking correct. They
take the exported constant now, and the parser test asserts the round trip
a reader on mmol/L experiences rather than a magic product.
This commit is contained in:
Marc-André Bombeck committed 2026-09-03 06:05:58 +02:00
1 parent 9e47b47b00
commit 4cb15232a2
2 files changed
+10 -3

No files matched your search

@@ -59,6 +59,7 @@ vi.mock("@/lib/rollups/measurement-rollups", async () => {
import { NextRequest } from "next/server";
import { POST } from "../route";
import { MGDL_PER_MMOL } from "@/lib/glucose";
import { checkRateLimit } from "@/lib/rate-limit";
import { prisma } from "@/lib/db";
import { recomputeBucketsForMeasurement } from "@/lib/rollups/measurement-rollups";
@@ -369,7 +370,7 @@ describe("POST /api/import/csv — contextless blood glucose", () => {
externalId: "sensor-1",
glucoseContext: null,
});
expect(row.value).toBeCloseTo(95.4848, 3);
expect(row.value).toBeCloseTo(5.3 * MGDL_PER_MMOL, 3);
expect((row.measuredAt as Date).toISOString()).toBe(
"2024-04-03T02:15:00.000Z",
);