import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import { DEFAULT_LLM_BASE_URL, DEFAULT_LLM_MODEL } from "@/lib/llm-config";
import { ChatPanel } from "./ChatPanel";
import seedWorkPackages from "../agentic_pm_demo_codex_plans/data/work-packages.seed.json";
import type { WorkPackage } from "@/lib/work-package-types";
const workPackages = seedWorkPackages as WorkPackage[];
function renderChatPanel(draft = "") {
return renderToStaticMarkup(
,
);
}
describe("ChatPanel", () => {
it("keeps model settings folded by default in mock mode", () => {
expect(renderChatPanel()).not.toContain("Paste your API key");
});
it("renders package suggestions when the draft ends with @ mention text", () => {
const html = renderChatPanel("@sr");
expect(html).toContain("@SRS");
expect(html).toContain("System Requirements Specification");
});
it("renders slash command suggestions when the draft ends with slash text", () => {
const html = renderChatPanel("/pl");
expect(html).toContain("/plan");
expect(html).toContain("Break a package into actionable work");
});
it("shows a test connection action when the model settings panel is open", () => {
const html = renderToStaticMarkup(
,
);
expect(html).toContain("Test connection");
});
});