Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a deterministic verification core: clinical-trial claims checked against ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI recomputed in code, oracle-tested), code-enforced exact-span grounding, and multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing at scale (unpdf + Docling), agentic workflows, Claude Science connector, compliance/audit, billing, public API, and more. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
import { describe, it, expect, afterEach } from "vitest";
|
|
import { cleanup, render, screen } from "@testing-library/react";
|
|
import { FindingCard } from "../../components/FindingCard";
|
|
import type { ExtractedFinding } from "../../lib/schemas";
|
|
|
|
afterEach(cleanup);
|
|
|
|
const finding: ExtractedFinding = {
|
|
effect_size: "18% relative risk reduction",
|
|
population: "adults 65+ with prior MI",
|
|
condition: "cardiovascular disease",
|
|
endpoint: "major adverse cardiovascular events at 24 months",
|
|
caveats: ["Open-label extension phase", "Excluded patients with renal impairment"],
|
|
};
|
|
|
|
describe("FindingCard", () => {
|
|
it("renders effect size, population, condition, and endpoint values", () => {
|
|
render(<FindingCard finding={finding} />);
|
|
|
|
expect(screen.getByText("18% relative risk reduction")).toBeInTheDocument();
|
|
expect(screen.getByText("adults 65+ with prior MI")).toBeInTheDocument();
|
|
expect(screen.getByText("cardiovascular disease")).toBeInTheDocument();
|
|
expect(
|
|
screen.getByText("major adverse cardiovascular events at 24 months"),
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders the field labels", () => {
|
|
render(<FindingCard finding={finding} />);
|
|
expect(screen.getByText("Effect size")).toBeInTheDocument();
|
|
expect(screen.getByText("Population")).toBeInTheDocument();
|
|
expect(screen.getByText("Condition")).toBeInTheDocument();
|
|
expect(screen.getByText("Endpoint")).toBeInTheDocument();
|
|
expect(screen.getByText("Caveats")).toBeInTheDocument();
|
|
});
|
|
|
|
it("renders each caveat as a list item", () => {
|
|
render(<FindingCard finding={finding} />);
|
|
expect(screen.getByText("Open-label extension phase")).toBeInTheDocument();
|
|
expect(
|
|
screen.getByText("Excluded patients with renal impairment"),
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it("shows 'None reported' when there are no caveats", () => {
|
|
render(<FindingCard finding={{ ...finding, caveats: [] }} />);
|
|
expect(screen.getByText("None reported")).toBeInTheDocument();
|
|
});
|
|
|
|
it("shows 'Not reported' for unreported fields", () => {
|
|
render(
|
|
<FindingCard finding={{ ...finding, effect_size: "not reported" }} />,
|
|
);
|
|
expect(screen.getByText("Not reported")).toBeInTheDocument();
|
|
});
|
|
});
|