// @vitest-environment jsdom import { describe, it, expect } from "vitest"; import { SLASH_COMMANDS, resolveAgentFromContent } from "../lib/slash-commands"; describe("slash-commands", () => { it("defines 5 slash commands", () => { expect(SLASH_COMMANDS).toHaveLength(5); }); it("/search is disabled", () => { const search = SLASH_COMMANDS.find((c) => c.command === "/search"); expect(search?.disabled).toBe(true); }); it("resolveAgentFromContent routes /ask-pm to pm agent", () => { const agents = [ { id: "a1", name: "PM", role: "pm" }, { id: "a2", name: "Eng", role: "engineer" }, ]; expect(resolveAgentFromContent("/ask-pm hello", agents, null)).toBe("a1"); }); it("resolveAgentFromContent routes @mention to matching agent", () => { const agents = [ { id: "a1", name: "PM Agent", role: "pm" }, { id: "a2", name: "Engineer", role: "engineer" }, ]; expect(resolveAgentFromContent("Hey @engineer help", agents, null)).toBe("a2"); }); it("resolveAgentFromContent returns activeAgentId when no match", () => { const agents = [{ id: "a1", name: "PM", role: "pm" }]; expect(resolveAgentFromContent("just a message", agents, "fallback-id")).toBe("fallback-id"); }); }); describe("ChatSlashCommandPopover", () => { it("exports ChatSlashCommandPopover component", async () => { const mod = await import("./ChatSlashCommandPopover"); expect(mod.ChatSlashCommandPopover).toBeDefined(); }); });