From e43e758c8d73ebf3360bbe56f453647bd4e0fd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 25 Jul 2026 21:56:10 +0200 Subject: [PATCH] docs(import): put a contextless sensor reading in the downloadable example The example CSV is the file people copy. It showed a glucose row with a FASTING context and nothing else, which is the shape a meter produces, not the shape a continuous sensor produces. It now carries both. Refs #640 --- .../settings/__tests__/import-panel.test.tsx | 12 ++++++++++++ .../settings/import-panel/import-examples.ts | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/components/settings/__tests__/import-panel.test.tsx b/src/components/settings/__tests__/import-panel.test.tsx index 8b55cb2d3..31df66cae 100644 --- a/src/components/settings/__tests__/import-panel.test.tsx +++ b/src/components/settings/__tests__/import-panel.test.tsx @@ -152,6 +152,18 @@ describe("EXAMPLE_CSV", () => { expect(out.rows.length).toBeGreaterThan(0); expect(out.rows.every((r) => r.status === "ok")).toBe(true); }); + + it("carries a contextless glucose reading, the shape a sensor export has", () => { + const out = parseCsvMeasurements(EXAMPLE_CSV, { + now: new Date("2026-06-01T00:00:00Z").getTime(), + }); + const glucose = out.rows + .map((r) => r.row) + .filter((row) => row?.type === "BLOOD_GLUCOSE"); + expect(glucose.length).toBeGreaterThanOrEqual(2); + expect(glucose.some((row) => row?.glucoseContext === undefined)).toBe(true); + expect(glucose.some((row) => row?.glucoseContext === "FASTING")).toBe(true); + }); }); describe("parseImportJson guard", () => { diff --git a/src/components/settings/import-panel/import-examples.ts b/src/components/settings/import-panel/import-examples.ts index 926fa3d1f..aaf154765 100644 --- a/src/components/settings/import-panel/import-examples.ts +++ b/src/components/settings/import-panel/import-examples.ts @@ -64,5 +64,9 @@ export const EXAMPLE_CSV = [ CSV_EXAMPLE_COLUMNS.join(","), "WEIGHT,80.5,kg,2026-05-01T08:00:00Z,,morning,", "BLOOD_GLUCOSE,5.3,mmol/L,2026-05-01T08:05:00+02:00,FASTING,,meter-001", + // A sensor export has no fasting / post-meal answer per reading, so the + // context cell is blank. The example carries that shape on purpose: it is + // the one people copy, and it is the case that used to be refused. + "BLOOD_GLUCOSE,5.9,mmol/L,2026-05-01T08:20:00+02:00,,,sensor-001", "BLOOD_PRESSURE_SYS,120,mmHg,2026-05-01T08:05:00+02:00,,,", ].join("\n");