From 53c2e342b08c3fe7ad7e34f599689d4f57eaa5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 10 Sep 2026 15:35:52 +0200 Subject: [PATCH] test(record-settings): hold the module write to the shared helper The guardian's modules branch no longer invalidates the health score in the route; the record-keyed write it shares with the setup flow does. The guard pinned the old call site and went red for a behaviour that had not changed. It now asserts the route goes through the shared write with the record id and that the helper is still the place that invalidates. --- .../record-settings-authorization.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/record-settings-authorization.test.ts b/tests/integration/record-settings-authorization.test.ts index e4f4341d2..f36d0438e 100644 --- a/tests/integration/record-settings-authorization.test.ts +++ b/tests/integration/record-settings-authorization.test.ts @@ -79,7 +79,17 @@ describe("record settings authorization", () => { expect(route).toContain("details: { changed }"); expect(route).not.toContain("details: { recordId:"); expect(route).toContain("invalidateUserMedications(access.recordId, {"); - expect(route).toContain("invalidateUserHealthScore(access.recordId)"); + // The module write is one record-keyed function shared with the setup + // flow's derivation; the health-score invalidation lives there, so the + // route must call it with the record and the helper must still invalidate. + expect(route).toContain("writeRecordModulePreferences({"); + expect(route).toContain("recordId: access.recordId,"); + expect(route).not.toContain("invalidateUserHealthScore("); + const moduleWrite = await readFile( + fromRoot("src/lib/record-settings/modules.ts"), + "utf8", + ); + expect(moduleWrite).toContain("invalidateUserHealthScore(input.recordId)"); expect(route).toContain("getAllEffectiveRanges(record, overrides)"); expect(route).toContain( "effective: getAllEffectiveRanges(record, overrides)",