import { render, screen } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { WorkflowSection } from "./task-create-dialog-form-body"; vi.mock("@/components/workflow-selector-row", () => ({ WorkflowSelectorRow: ({ selectedWorkflowId }: { selectedWorkflowId: string | null }) => ( ), })); const workflow = { id: "wf-1", name: "Development" }; function renderWorkflowSection(effectiveWorkflowId: string | null) { return render( {}} agentProfiles={[]} />, ); } describe("WorkflowSection", () => { it("keeps the selector reachable when no effective workflow is selected", () => { renderWorkflowSection(null); expect(screen.getByRole("button", { name: /workflow selector none/i })).toBeTruthy(); }); it("does not show redundant selector for a selected single workflow without overrides", () => { const { container } = renderWorkflowSection("wf-1"); expect(container.textContent).toBe(""); }); });