mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
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:
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 () => {
|
||||
|
||||
Reference in new issue
Block a user