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,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { demoInspection } from "./demo";
|
||||
import { inspectionToMarkdown } from "./report";
|
||||
|
||||
describe("report export", () => {
|
||||
it("exports the health score, findings and normalized evidence", () => {
|
||||
const report = inspectionToMarkdown(demoInspection);
|
||||
expect(report).toContain("# CertScope report — portfolio-demo.invalid");
|
||||
expect(report).toContain("Overall health: 98/100");
|
||||
expect(report).toContain("Score formula: equal-weighted average");
|
||||
expect(report).toContain("Completeness: complete (3/3 collectors complete)");
|
||||
expect(report).toContain("- DNS: ok");
|
||||
expect(report).toContain("Content-Security-Policy is missing");
|
||||
expect(report).toContain("## DNS evidence");
|
||||
expect(report).toContain("## TLS evidence");
|
||||
expect(report).toContain("## HTTP evidence");
|
||||
});
|
||||
|
||||
it("escapes finding text and keeps JSON evidence fences safe", () => {
|
||||
const report = inspectionToMarkdown({
|
||||
...demoInspection,
|
||||
findings: [{
|
||||
...demoInspection.findings[0],
|
||||
title: "Injected *title* [value]",
|
||||
summary: "line one\nline two",
|
||||
}],
|
||||
http: { ...demoInspection.http, injected: "```\nnot a markdown fence" },
|
||||
});
|
||||
|
||||
expect(report).toContain("### Injected \\*title\\* \\[value\\]");
|
||||
expect(report).toContain("- Summary: line one line two");
|
||||
expect(report).toContain("injected");
|
||||
expect(report.match(/^`{3,}(json)?$/gm)?.length).toBe(6);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user