mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
test: cover managed profile Guardian races
- Exercise concurrent final-Guardian reductions against Postgres\n- Cover recoverable account and profile deletion paths
This commit is contained in:
1 parent
e5e3590ca3
commit
5059bc9b69
3 files changed
+174
No files matched your search
@@ -31,4 +31,25 @@ describe("managed-profile contract", () => {
|
||||
routes.some((entry) => entry.toLowerCase().includes("emancip")),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("uses the same record lock for every Guardian-reducing transition", async () => {
|
||||
const lifecycle = await readFile(
|
||||
path.join(root, "src/lib/managed-profiles/lifecycle.ts"),
|
||||
"utf8",
|
||||
);
|
||||
const grants = await readFile(
|
||||
path.join(root, "src/lib/sharing/grants.ts"),
|
||||
"utf8",
|
||||
);
|
||||
const accountDeletion = await readFile(
|
||||
path.join(root, "src/app/api/settings/account/route.ts"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
expect(lifecycle).toContain("pg_advisory_xact_lock");
|
||||
expect(lifecycle).toContain("clearManagedProfileMarker");
|
||||
expect(lifecycle).toContain("deleteManagedProfile");
|
||||
expect(grants).toContain("reduceManagedProfileGuardian");
|
||||
expect(accountDeletion).toContain("deleteGuardianAccountWithLifecycle");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user