import { fireEvent, render, screen } from "@testing-library/react"; import { describe, expect, it } from "vitest"; import AssistantWorkspace, { AssistantSetupPanel } from "./AssistantWorkspace"; describe("AssistantWorkspace", () => { it("collapses setup after the first conversation turn and allows reopening it", () => { const { rerender } = render(
Setup body
); expect(screen.getByText("Use setup before starting.")).toBeInTheDocument(); expect(screen.getByText("Setup body")).toBeInTheDocument(); rerender(
Setup body
); expect(screen.queryByText("Use setup before starting.")).not.toBeInTheDocument(); expect(screen.queryByText("Setup body")).not.toBeInTheDocument(); fireEvent.click(screen.getByRole("button", { name: "Show setup" })); expect(screen.getByText("Setup body")).toBeInTheDocument(); }); it("shows setup by default before the conversation starts", () => { render( Setup body} toolsContent={
Tools body
} conversationContent={
Conversation body
} secondaryRail={
Prompt rail
} /> ); expect(screen.getByText("Use setup before starting.")).toBeInTheDocument(); expect(screen.getByText("Setup body")).toBeInTheDocument(); expect(screen.getByText("Tools body")).toBeInTheDocument(); }); it("reopens setup after the conversation is reset", () => { const { rerender } = render(
Setup body
); expect(screen.queryByText("Setup body")).not.toBeInTheDocument(); rerender(
Setup body
); expect(screen.getByText("Use setup before starting.")).toBeInTheDocument(); expect(screen.getByText("Setup body")).toBeInTheDocument(); }); });