Initial curated CertScope source from fe2bbe3ca5c98bf64be26a09c6c58ee805a7f87e
This commit is contained in:
commit
7348faf6c0
65 files changed
+12509
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { demoInspection } from "./demo";
|
||||
import { isInspectionResult } from "./validation";
|
||||
|
||||
describe("inspection result runtime validation", () => {
|
||||
it("accepts the normalized result contract", () => {
|
||||
expect(isInspectionResult(demoInspection)).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
null,
|
||||
{},
|
||||
{ ...demoInspection, host: "" },
|
||||
{ ...demoInspection, inspectedAt: "not-a-date" },
|
||||
{ ...demoInspection, score: { overall: 100, categories: { dns: 100 } } },
|
||||
{ ...demoInspection, completeness: { ...demoInspection.completeness, collectors: { dns: "unknown", tls: "ok", http: "ok" } } },
|
||||
{ ...demoInspection, completeness: { ...demoInspection.completeness, complete: 4, total: 3 } },
|
||||
{ ...demoInspection, findings: [{ id: "missing-fields" }] },
|
||||
{ ...demoInspection, findings: [{ ...demoInspection.findings[0], category: "unknown" }] },
|
||||
{ ...demoInspection, findings: [{ ...demoInspection.findings[0], evidence: [42] }] },
|
||||
{ ...demoInspection, findings: [{ ...demoInspection.findings[0], remediation: { unexpected: true } }] },
|
||||
])("rejects malformed payload %#", (payload) => {
|
||||
expect(isInspectionResult(payload)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user