From f6b46dafd402ada4bc3c93e98141dfa4f4ea1622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 14 Jun 2026 14:27:04 +0200 Subject: [PATCH] test(doctor-report): give the section-toggle fixture a medication schedule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dose-ledger adherence builder only tallies scheduled medications — a medication with no schedule is PRN/as-needed and carries no expected dose, so it is excluded to keep a fabricated 100 % off the clinical report. The shared fixture seeded a schedule-less medication, which now yields an empty compliance map; seed a window so the default-sections test keeps a compliance entry. --- tests/integration/doctor-report-sections.test.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/integration/doctor-report-sections.test.ts b/tests/integration/doctor-report-sections.test.ts index f702eabd8..7075e163e 100644 --- a/tests/integration/doctor-report-sections.test.ts +++ b/tests/integration/doctor-report-sections.test.ts @@ -123,13 +123,21 @@ async function seedUserWithEveryDataType(username: string): Promise { }, }); - // Medication compliance — one taken intake event. + // Medication compliance — one taken intake event against a scheduled + // medication. The ledger compliance builder (v1.17 W1a) only tallies + // medications that carry a schedule (no schedule = PRN/as-needed = no + // expected dose = excluded so the report never prints a fabricated + // 100 %), so the fixture must seed a window for the drug to appear in + // `data.compliance`. const med = await prisma.medication.create({ data: { userId: user.id, name: "Metformin", dose: "500 mg", active: true, + schedules: { + create: [{ windowStart: "08:00", windowEnd: "10:00" }], + }, }, }); await prisma.medicationIntakeEvent.create({