import { describe, it, expect } from "vitest"; import { componentTestSuite, type ComponentTestSuiteConfig, } from "../utils/componentTestSuite"; import TextBlock from "../../app/components/type/TextBlock"; import { screen } from "@testing-library/react"; import { renderWithProviders as render } from "../utils/test-utils"; type Props = React.ComponentProps; const config: ComponentTestSuiteConfig = { component: TextBlock, name: "TextBlock", props: { title: "Policy title", body: "Supporting text for the policy.", } as Props, requiredProps: ["title"], testCases: { renders: true, accessibility: true, }, }; describe("TextBlock", () => { componentTestSuite(config); it("renders labeled row imageUrl as img", () => { render( , ); const img = screen.getByRole("img", { name: "Photo" }); expect(img).toHaveAttribute( "src", "/api/uploads/aaaaaaaa-bbbb-4ccc-dddd-eeeeeeeeeeee", ); }); it("renders body paragraphs above labeled rows when both are set", () => { render( , ); expect(screen.getByText("Anyone can start a thread.")).toBeInTheDocument(); expect(screen.getByText("Quorum")).toBeInTheDocument(); expect(screen.getByText("60%")).toBeInTheDocument(); }); });