mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
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.
This commit is contained in:
1 parent
66ae214100
commit
53c2e342b0
1 file changed
+11
-1
@@ -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)",
|
||||
|
||||
Reference in new issue
Block a user