From 5b3883859403b0710af491fbf3feb26763432542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 26 Jul 2026 11:05:10 +0200 Subject: [PATCH] test(medications): type the container fixture so the overrides compile `Partial` inferred the literal types off the base fixture, so an override could not swap the container kind or null a date. The fixture takes an explicit row shape instead. --- .../inventory-section-dates.test.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/medications/__tests__/inventory-section-dates.test.tsx b/src/components/medications/__tests__/inventory-section-dates.test.tsx index 3cc8b63c9..fe9475895 100644 --- a/src/components/medications/__tests__/inventory-section-dates.test.tsx +++ b/src/components/medications/__tests__/inventory-section-dates.test.tsx @@ -95,13 +95,23 @@ function seedItems(items: unknown[]) { }); } +interface Row { + id: string; + state: "ACTIVE" | "IN_USE" | "EXPIRED" | "USED_UP"; + containerType: "PEN" | "AMPOULE" | "BLISTER" | "INHALER" | "BOTTLE" | "OTHER"; + unitsTotal: number | null; + unitsRemaining: number | null; + printedExpiry: string | null; + firstUseAt: string | null; +} + const BASE = { id: "i1", - state: "IN_USE" as const, - containerType: "BLISTER" as const, + state: "IN_USE", + containerType: "BLISTER", unitsTotal: 60, unitsRemaining: 54, -}; +} satisfies Omit; describe(" — item-row dates", () => { it("renders the opening date on the row", () => { @@ -161,13 +171,13 @@ describe(" — item-row dates", () => { }); describe(" — editable dates", () => { - const item = { + const item: Row = { ...BASE, firstUseAt: "2026-06-12T00:00:00.000Z", printedExpiry: "2027-06-01T00:00:00.000Z", }; - function renderDialog(over: Partial = {}): string { + function renderDialog(over: Partial = {}): string { return render(