import { describe, expect, it } from "vitest"; import { failureCount, renderReport } from "./verify-billing-boundary-baseline.mjs"; describe("verify-billing-boundary-baseline", () => { it("does not count successful gate output as failures", () => { expect(failureCount("lint", "warning only", "", 0)).toBe(0); expect(failureCount("vitest-billing-boundary", "Tests 30 passed", "", 0)).toBe(0); expect(failureCount("billing-inventory", "total matches: 12", "", 0)).toBe(0); }); it("counts failed typecheck diagnostics conservatively", () => { const output = "src/a.ts(1,1): error TS2307: Cannot find module\nsrc/b.ts(2,2): error TS2322: Type mismatch"; expect(failureCount("typecheck", output, "", 1)).toBe(2); }); it("renders required Billing Boundary report sections", () => { const report = renderReport([ { id: "billing-inventory", command: "read-only billing inventory", exitCode: 0, durationMs: 10, failureCount: 0, fingerprint: { hash: "abc123", excerpt: "total matches: 0" }, }, ]); expect(report).toContain("# Billing Boundary Baseline Health"); expect(report).toContain("## billing-inventory"); expect(report).toContain("Output Fingerprint: abc123"); }); });