From 77ba829fcf6bab6dd329367af5d8a57c6259b132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 9 Aug 2026 00:28:32 +0200 Subject: [PATCH] test(sharing): drive the booster admission through its owned effect The booster route was admitted into the MANAGE matrix but had no driver, so the strict-driver and real-effect inventories stayed one short of the admission count and the completeness guards failed. Register the write-effect driver that mints the reminder against a tetanus dose and asserts the delegated WRITE actor on the audit row, matching every other admitted write. --- .../sharing-manage-handler-matrix.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/integration/sharing-manage-handler-matrix.test.ts b/tests/integration/sharing-manage-handler-matrix.test.ts index 773c317c8..a44f1776a 100644 --- a/tests/integration/sharing-manage-handler-matrix.test.ts +++ b/tests/integration/sharing-manage-handler-matrix.test.ts @@ -1556,6 +1556,25 @@ manageContract("POST /api/vaccinations/[id]/restore", { )?.deletedAt === null, }); +proveWriteRoute("POST /api/vaccinations/[id]/booster", { + route: "/api/vaccinations/[id]/booster", + // The dose the booster is planned against. `makeVaccination` records a + // monovalent tetanus dose, so the mint keys the reminder on the tetanus + // antigen and `applied` can prove exactly one reminder now carries it. + prepare: async (ownerId) => ({ + ownerId, + vaccination: await makeVaccination(ownerId), + }), + params: ({ vaccination }) => ({ id: vaccination.id }), + body: () => ({ intervalMonths: 120, label: "Tetanus booster" }), + ok: 201, + auditAction: "vaccination.booster.planned", + applied: async ({ ownerId }) => + (await getPrismaClient().measurementReminder.count({ + where: { userId: ownerId, vaccinationAntigen: "tetanus" }, + })) === 1, +}); + manageContract("POST /api/illness/episodes/[id]/day-logs", { contract: ADMITTED_MUTATING_HANDLERS.find( (entry) =>