From 208a2248cded2ce13da909c675e35ebd598c7c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 25 Jul 2026 21:57:06 +0200 Subject: [PATCH] test(import): cover the HealthKit glucose shape against the relaxed constraint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A HealthKit blood-glucose sample carries no context either — the mapping has no field for one — so the batch ingest was building the same row the old CHECK refused. Fold that source into the case that pins the contextless shape. Refs #640 --- .../csv-import-contextless-glucose.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/integration/csv-import-contextless-glucose.test.ts b/tests/integration/csv-import-contextless-glucose.test.ts index 15dde8f74..dad86ab24 100644 --- a/tests/integration/csv-import-contextless-glucose.test.ts +++ b/tests/integration/csv-import-contextless-glucose.test.ts @@ -189,10 +189,11 @@ describe("measurements.glucose_context — surviving CHECK half", () => { it("accepts the contextless shape the device writers build", async () => { await signIn(); - // The Nightscout SGV upsert and the MCP / Telegram single-value capture - // both build a BLOOD_GLUCOSE row with no context. Under the old - // constraint every one of those inserts was refused by the database. - const sources = ["NIGHTSCOUT", "MCP", "TELEGRAM"] as const; + // The Nightscout SGV upsert, the HealthKit batch mapping, and the MCP / + // Telegram single-value captures all build a BLOOD_GLUCOSE row with no + // context. Under the old constraint every one of those inserts was + // refused by the database. + const sources = ["NIGHTSCOUT", "APPLE_HEALTH", "MCP", "TELEGRAM"] as const; for (const [index, source] of sources.entries()) { await getPrismaClient().measurement.create({ data: { @@ -209,7 +210,7 @@ describe("measurements.glucose_context — surviving CHECK half", () => { const rows = await getPrismaClient().measurement.findMany({ where: { userId: USER, type: "BLOOD_GLUCOSE" }, }); - expect(rows).toHaveLength(3); + expect(rows).toHaveLength(sources.length); expect(rows.every((row) => row.glucoseContext === null)).toBe(true); }); });