fix: report renders empty-truth roles as n/a with spurious count

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Sonnet 5.5 committed 2026-10-30 05:17:14 +01:00
1 parent 42d88a2401
commit d9fd5d8c9f
2 files changed
+32 -13

No files matched your search

+11 -2
View File
@@ -31,8 +31,9 @@ const mk = (g: number): BenchRun => ({
describe("renderReport", () => {
test("column order, n/a, caveat", () => {
const md = renderReport(mk(0.9));
expect(md.indexOf("Guitar")).toBeLessThan(md.indexOf("Vocals"));
expect(md.indexOf("Vocals")).toBeLessThan(md.indexOf("Bass"));
const header = md.split("\n").find((l) => l.startsWith("| Mode"))!;
expect(header.indexOf("Guitar merged F1")).toBeLessThan(header.indexOf("Vocals F1"));
expect(header.indexOf("Vocals F1")).toBeLessThan(header.indexOf("Bass F1"));
expect(md).toContain("n/a");
expect(md).toContain("Voice Oohs");
expect(md).toContain("fx");
@@ -43,4 +44,12 @@ describe("renderReport", () => {
expect(bad).toContain("FAIL");
expect(bad).not.toContain("Tier t1a: PASS");
});
test("role with empty truth renders n/a with spurious count", () => {
const run = mk(0.9);
const s = run.results[0]!.score;
s.perRole.bass = { ...mr(0), tp: 0, fp: 3, fn: 0 };
const md = renderReport({ ...run, results: [run.results[0]!] });
expect(md).toContain("n/a (3 spurious)");
expect(md).not.toContain("0.00 (0.00");
});
});