test(doctor-report): give the section-toggle fixture a medication schedule

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.
This commit is contained in:
Marc-André Bombeck committed 2026-06-14 14:27:04 +02:00
1 parent 5e36664f7d
commit f6b46dafd4
1 file changed
+9 -1
@@ -123,13 +123,21 @@ async function seedUserWithEveryDataType(username: string): Promise<string> {
},
});
// 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({