/** Test results card sub-components for WorkItemDetailPanel. */
import type { TestCaseResult, TestResultsResponse } from "../api/client";
function TestCaseRow({ tc }: { tc: TestCaseResult }) {
const isPassing = tc.status === "pass";
return (
{isPassing ? "PASS" : "FAIL"}
{tc.name}
{tc.details && (
{tc.details}
)}
);
}
function TestSection({
title,
tests,
testId,
}: {
title: string;
tests: TestCaseResult[];
testId: string;
}) {
const passCount = tests.filter((t) => t.status === "pass").length;
const failCount = tests.length - passCount;
return (
{title} ({passCount} passed, {failCount} failed)
{tests.length === 0 ? (
No tests recorded
) : (
tests.map((tc) =>
)
)}
);
}
/** Renders the "Test Results" card in the detail panel. */
export function TestResultsSection({
testResults,
}: {
testResults: TestResultsResponse | null;
}) {
const hasTestResults =
testResults &&
(testResults.unit.length > 0 || testResults.integration.length > 0);
return (
Test Results
{hasTestResults ? (
) : (
No test results recorded
)}
);
}