30 lines
1005 B
TypeScript
30 lines
1005 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { NoopAuditLog } from "./noop-audit-log";
|
|
import type { AuditEntry } from "@repo/core-shared/audit";
|
|
|
|
describe("NoopAuditLog", () => {
|
|
const sample: AuditEntry = {
|
|
actorId: "user_1",
|
|
actorType: "user",
|
|
actorRoles: [],
|
|
action: "VIEW",
|
|
resource: { type: "articles", id: "1" },
|
|
at: new Date(),
|
|
scope: { feature: "blog", environment: "test", tenant: "default" },
|
|
from: { ipTruncated: "10.0.0.0", userAgent: "test" },
|
|
containsPii: false,
|
|
outcome: "success",
|
|
};
|
|
|
|
it("record() is a no-op that does not throw", async () => {
|
|
const log = new NoopAuditLog();
|
|
await expect(log.record(sample)).resolves.toBeUndefined();
|
|
});
|
|
|
|
it("eraseSubject() is a no-op that does not throw", async () => {
|
|
const log = new NoopAuditLog();
|
|
await expect(log.eraseSubject("user_1", "pseudonymize")).resolves.toBeUndefined();
|
|
await expect(log.eraseSubject("user_1", "delete")).resolves.toBeUndefined();
|
|
});
|
|
});
|