From 7b59388887a5725f552a205e62337ee51b92ee91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 26 Jul 2026 10:55:11 +0200 Subject: [PATCH] test(medications): make the repair's idempotency assertion able to fail The comparison now includes `updated_at`, so a second application that rewrites an already-correct row is visible even when the value it writes is identical. Without it the assertion passed whether or not the guard that skips untouched rows was there. --- .../inventory-expiry-container-type-repair.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/inventory-expiry-container-type-repair.test.ts b/tests/integration/inventory-expiry-container-type-repair.test.ts index 2ee6868c9..b27c363d6 100644 --- a/tests/integration/inventory-expiry-container-type-repair.test.ts +++ b/tests/integration/inventory-expiry-container-type-repair.test.ts @@ -74,6 +74,9 @@ async function readItem(prisma: PrismaClient, id: string) { printedExpiry: true, firstUseAt: true, unitsRemaining: true, + // Part of the read so the idempotency assertion below can see a + // second application touching a row it should have skipped. + updatedAt: true, }, }); return row; @@ -280,7 +283,10 @@ describe("0276 inventory expiry container-type repair — integration", () => { expect(row.expiresAt).toEqual(expiresAt); }); - it("is idempotent — a second application changes nothing", async () => { + it("is idempotent — a second application touches nothing", async () => { + // `updatedAt` is part of the compared shape, so a second pass that + // rewrites an already-correct row is visible even when the value it + // writes is the same one. const prisma = getPrismaClient(); const id = await seedItem(prisma, medicationId, { containerType: "BLISTER",