import { render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import type { ToolCall } from "../reducer"; import { ToolCallCard } from "./ToolCallCard"; function call(overrides: Partial): ToolCall { return { toolCallId: "c1", title: "A tool call", toolKind: "other", status: "completed", contents: [], locations: [], ...overrides, }; } describe("ToolCallCard", () => { it("renders execute output verbatim in a monospace block", () => { const { container } = render( , ); const output = container.querySelector("pre.tool-output"); expect(output).not.toBeNull(); // Verbatim: the "* " prefix must not have become a markdown list. expect(output?.textContent).toBe("* main\n remote/origin"); expect(container.querySelector("ul li")).toBeNull(); }); it("renders backticked commands in the title as monospace code", () => { const { container } = render( , ); const code = container.querySelector(".tool-title code.inline-code"); expect(code?.textContent).toBe("ls .memory/"); }); it("renders non-execute text content as markdown", () => { const { container } = render( , ); expect(container.querySelector("pre.tool-output")).toBeNull(); expect(screen.getByText("bold")).toBeDefined(); }); });