import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { CompDocCell } from "@/app/(protected)/workorders/_components/list/table/cells/comp-doc-cell"; describe("CompDocCell service gate", () => { it("shows a disabled placeholder when no service is selected", () => { const onOpen = vi.fn(); render(); expect(screen.getByText("Select service")).toBeInTheDocument(); expect(screen.queryByRole("button", { name: /draft|view doc|n\/n/i })).not.toBeInTheDocument(); }); it("opens CompDoc when a service is selected", () => { const onOpen = vi.fn(); render( , ); screen.getByRole("button", { name: /draft/i }).click(); expect(onOpen).toHaveBeenCalledTimes(1); }); });