mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
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
This commit is contained in:
1 parent
4e95bd28f8
commit
e43e758c8d
2 files changed
+16
No files matched your search
@@ -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", () => {
|
||||
|
||||
@@ -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");
|
||||
Reference in new issue
Block a user