39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { ComplianceService } from "../src/compliance/compliance.service";
|
|
|
|
const createService = () => {
|
|
const prisma = {
|
|
auditLog: { count: jest.fn() },
|
|
exportLog: { count: jest.fn() },
|
|
abuseEvent: { count: jest.fn() },
|
|
session: { count: jest.fn() },
|
|
};
|
|
|
|
return { service: new ComplianceService(prisma as any), prisma };
|
|
};
|
|
|
|
describe("ComplianceService", () => {
|
|
it("returns SOC 2 readiness evidence without claiming certification", async () => {
|
|
const { service, prisma } = createService();
|
|
prisma.auditLog.count.mockResolvedValue(12);
|
|
prisma.exportLog.count.mockResolvedValue(3);
|
|
prisma.abuseEvent.count.mockResolvedValue(2);
|
|
prisma.session.count.mockResolvedValue(1);
|
|
|
|
const result = await service.getSoc2Readiness("user_1");
|
|
|
|
expect(result.readinessStatus).toBe("technical_baseline_ready");
|
|
expect(result.certificationStatus).toBe("not_certified");
|
|
expect(result.evidenceSummary).toEqual({
|
|
auditLogCount: 12,
|
|
exportLogCount: 3,
|
|
abuseEventCount: 2,
|
|
activeSessionCount: 1,
|
|
});
|
|
expect(result.controls).toEqual(expect.arrayContaining([
|
|
expect.objectContaining({ id: "CC6.1", status: "implemented" }),
|
|
expect.objectContaining({ id: "CC8.1", status: "partial" }),
|
|
]));
|
|
expect(result.pendingExternalControls.length).toBeGreaterThan(0);
|
|
});
|
|
});
|