diff --git a/src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx b/src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx index 149d34bbfa..64491c1d3e 100644 --- a/src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx +++ b/src/__tests__/unit/components/BenchmarkRunsHistory.test.tsx @@ -333,7 +333,8 @@ describe("BenchmarkRunsHistory", () => { setExpandedId: mockSetExpandedId, }); render(React.createElement(BenchmarkRunsHistory)); - expect(screen.getByText("72/74")).toBeInTheDocument(); + expect(screen.getByTestId("passed-cell-count").textContent).toBe("72"); + expect(screen.getByTestId("total-cell-count").textContent).toBe("74"); expect(screen.getByText("PASS")).toBeInTheDocument(); }); @@ -347,7 +348,8 @@ describe("BenchmarkRunsHistory", () => { setExpandedId: mockSetExpandedId, }); render(React.createElement(BenchmarkRunsHistory)); - expect(screen.getByText("10/20")).toBeInTheDocument(); + expect(screen.getByTestId("passed-cell-count").textContent).toBe("10"); + expect(screen.getByTestId("total-cell-count").textContent).toBe("20"); expect(screen.queryByText("FAIL")).toBeNull(); expect(screen.queryByText("PASS")).toBeNull(); }); @@ -467,7 +469,7 @@ describe("BenchmarkRunsHistory", () => { // ─── colSpan tests ───────────────────────────────────────────────────────── - it("expanded row colSpan is 9 for non-super-admin (Task + Type + Started + Runner Status + Score + Contested + Disputed + Chat + Report)", async () => { + it("expanded row colSpan is 11 for non-super-admin (Task + Type + Started + Runner Status + Passed + Failed + Contested + Disputed + Total + Chat + Report)", async () => { const user = userEvent.setup(); render(React.createElement(BenchmarkRunsHistory)); @@ -475,7 +477,7 @@ describe("BenchmarkRunsHistory", () => { await user.click(row); const expandedCell = screen.getByTestId("results-runner-1").closest("td")!; - expect(expandedCell.getAttribute("colspan")).toBe("9"); + expect(expandedCell.getAttribute("colspan")).toBe("11"); }); it("expanded row colSpan is 10 for super-admin (adds Stakwork column)", async () => { @@ -492,7 +494,7 @@ describe("BenchmarkRunsHistory", () => { await user.click(row); const expandedCell = screen.getByTestId("results-runner-1").closest("td")!; - expect(expandedCell.getAttribute("colspan")).toBe("10"); + expect(expandedCell.getAttribute("colspan")).toBe("12"); }); // ─── Existing interaction tests ──────────────────────────────────────────── @@ -774,7 +776,7 @@ describe("BenchmarkRunsHistory", () => { await user.click(row); const expandedCell = screen.getByTestId("results-runner-1").closest("td")!; - expect(expandedCell.getAttribute("colspan")).toBe("9"); + expect(expandedCell.getAttribute("colspan")).toBe("11"); }); // ─── Chat column tests ───────────────────────────────────────────────────── @@ -1236,7 +1238,8 @@ describe("BenchmarkRunsHistory — run types", () => { render(); const row = screen.getByTestId("run-row-a-1"); - expect(row.textContent).toContain("34/39"); + expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("34"); + expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("39"); expect(row.textContent).not.toContain("FAIL"); const links = screen.getAllByTestId("run-report-link"); expect( @@ -1363,10 +1366,11 @@ describe("BenchmarkRunsHistory — graph-first score numerators", () => { const row = screen.getByTestId("run-row-r-1"); // Graph numerator 8/10 against the roster denominator (10 - 2 contested) - expect(row.textContent).toContain("8/8"); + expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("8"); + expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("8"); expect(row.textContent).toContain("PASS"); expect(scoreSourceOf("run-row-r-1")).toBe("graph"); - expect(screen.getByTestId("score-cell-contested")).toBeInTheDocument(); + expect(screen.getByTestId("contested-cell-count")).toBeInTheDocument(); }); it("falls back to the result-table score when no graph output joins", () => { @@ -1389,7 +1393,8 @@ describe("BenchmarkRunsHistory — graph-first score numerators", () => { render(); const row = screen.getByTestId("run-row-r-1"); - expect(row.textContent).toContain("34/39"); + expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("34"); + expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("39"); expect(row.textContent).not.toContain("FAIL"); expect(scoreSourceOf("run-row-r-1")).toBe("result"); }); @@ -1414,7 +1419,8 @@ describe("BenchmarkRunsHistory — graph-first score numerators", () => { render(); const row = screen.getByTestId("run-row-m-1"); - expect(row.textContent).toContain("60/74"); + expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("60"); + expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("74"); expect(scoreSourceOf("run-row-m-1")).toBe("graph"); // The hook was asked for this task's trigger ref (the requirement-hosted // trigger only the row knows about). @@ -1451,9 +1457,10 @@ describe("BenchmarkRunsHistory — graph-first score numerators", () => { const row = screen.getByTestId("run-row-m-1"); // Node counts verbatim: NOT contested-adjusted, NOT the result-column 50/74 - expect(row.textContent).toContain("9/10"); + expect(row.querySelector('[data-testid="passed-cell-count"]')?.textContent).toBe("9"); + expect(row.querySelector('[data-testid="total-cell-count"]')?.textContent).toBe("10"); expect(scoreSourceOf("run-row-m-1")).toBe("output-ref"); - expect(screen.queryByTestId("score-cell-contested")).toBeNull(); + expect(screen.queryByTestId("contested-cell-count")).toBeNull(); // The pointer was requested from the graph-scores hook expect(mockGraphScoresMapHook).toHaveBeenCalledWith([ { taskSlug: TASK, triggerRefs: ["trig-1"], outputRefs: ["out-9"] }, diff --git a/src/__tests__/unit/components/legal/BenchmarkRunsHistory-breakdown.test.tsx b/src/__tests__/unit/components/legal/BenchmarkRunsHistory-breakdown.test.tsx index 63612f7460..cb20068458 100644 --- a/src/__tests__/unit/components/legal/BenchmarkRunsHistory-breakdown.test.tsx +++ b/src/__tests__/unit/components/legal/BenchmarkRunsHistory-breakdown.test.tsx @@ -6,7 +6,7 @@ * The runs-history rows no longer render the RubricBreakdownStrip — contested * and disputed detail lives in the run report instead. These tests verify that * no strip chips appear in rows on any path, and that the invisible - * score-cell-contested data anchor (used to verify contested-exclusion score + * contested-cell-count data anchor (used to verify contested-exclusion score * derivation) is still applied when the row's score excludes contested criteria. * * NOTE: Because the adjusted* arrays are internal to the component, we test @@ -191,7 +191,7 @@ describe("BenchmarkRunsHistory — ScoreCell breakdown strip", () => { expect(screen.queryByTestId("rubric-breakdown-disputed")).not.toBeInTheDocument(); }); - it("scoring path: no strip chips render; score-cell-contested anchor present exactly once", () => { + it("scoring path: no strip chips render; contested-cell-count anchor present exactly once", () => { const roster = [ { ref_id: "r1", id: "C-001", name: "Criterion 1", contested: false }, { ref_id: "r2", id: "C-002", name: "Criterion 2", contested: false }, @@ -224,6 +224,6 @@ describe("BenchmarkRunsHistory — ScoreCell breakdown strip", () => { expect(screen.queryByTestId("rubric-breakdown-contested")).toBeNull(); expect(screen.queryByTestId("rubric-breakdown-disputed")).toBeNull(); // The invisible data anchor still marks rows whose score excludes contested criteria. - expect(screen.getAllByTestId("score-cell-contested").length).toBe(1); + expect(screen.getAllByTestId("contested-cell-count").length).toBe(1); }); }); diff --git a/src/components/legal/BenchmarkRunsHistory.tsx b/src/components/legal/BenchmarkRunsHistory.tsx index 60e35d0b11..f69b51722e 100644 --- a/src/components/legal/BenchmarkRunsHistory.tsx +++ b/src/components/legal/BenchmarkRunsHistory.tsx @@ -528,7 +528,7 @@ export function BenchmarkRunsHistory({ // colSpan: Task + Type + Started + Runner Status + Score + Contested + // Disputed + Chat + Report + (Stakwork if super admin) - const colSpan = isSuperAdmin ? 10 : 9; + const colSpan = isSuperAdmin ? 12 : 11; return (