fix(test): read the audit details as the string the writer stores

`auditLog` serialises `details` with `JSON.stringify` into a text column,
so the assertion was reading a field off a string and finding nothing.

Refs #939
This commit is contained in:
Marc-André Bombeck committed 2026-09-10 01:09:50 +02:00
1 parent 90ca2cd899
commit bed2ab568e
1 file changed
+3 -3
@@ -216,9 +216,9 @@ describe("PATCH /api/managed-profiles/{id}", () => {
where: { action: "managed_profile.updated", userId: profile.id },
});
expect(audit.actorUserId).toBe(guardian.id);
expect(
((audit.details as { changed?: string[] } | null)?.changed ?? []).sort(),
).toEqual(["displayName", "timezone"]);
// `auditLog` stores `details` as a JSON STRING, not as a Json column.
const details = JSON.parse(audit.details ?? "{}") as { changed?: string[] };
expect((details.changed ?? []).sort()).toEqual(["displayName", "timezone"]);
});
it("records the sex a Guardian sets, which is what the cycle module reads", async () => {