import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { describe, expect, it } from "vitest"; import { Workbench } from "../../src/components/Workbench"; describe("Format Lab workbench", () => { it("shows catalog expectations beside initial measured changes", () => { render(); expect( screen.getByRole("heading", { name: "Format Lab" }), ).toBeInTheDocument(); expect(screen.getAllByText("measured changed").length).toBeGreaterThan(0); expect( screen.getByRole("row", { name: /Document metadata.*not tested/iu }), ).toBeInTheDocument(); }); it("retains evidence after malformed input and disables unsupported execution", async () => { const user = userEvent.setup(); render(); const previous = ( screen.getByLabelText("Conversion output") as HTMLTextAreaElement ).value; await user.clear(screen.getByLabelText("Source data")); await user.type(screen.getByLabelText("Source data"), "[["); await user.click( screen.getByRole("button", { name: "Run selected round trip" }), ); expect(screen.getByRole("alert")).toHaveTextContent(/retained/u); expect(screen.getByLabelText("Conversion output")).toHaveValue(previous); await user.selectOptions(screen.getByLabelText("Domain"), "image"); expect( screen.getByRole("button", { name: "Run selected round trip" }), ).toBeDisabled(); }); });