import { describe, expect, test } from "bun:test"; import { renderToStaticMarkup } from "react-dom/server"; import { SessionCapabilityFrame } from "../../../components/session-capability-frame"; const props = { name: "Writing style", subtitle: "Reviewed library skill", logo: null, typeLabel: "Skill", description: "Plain-language release notes with consistent structure and tone.", skill: true, expanded: false, complete: false, actionLabel: "Review skill", note: "Skill content is reviewed separately from permission to use any integration.", onOpen: () => {}, onClose: () => {}, }; describe("compact conversation card states", () => { test("suggestion has the preview hierarchy, monogram and reassurance", () => { const html = renderToStaticMarkup(); expect(html).toContain('data-state="suggested"'); expect(html).toContain("og-session-capability-shell"); expect(html).toContain("Guidance only · no account access"); expect(html).toContain("Review skill"); expect(html).toContain('aria-hidden="true">WR'); expect(html).not.toContain("sparkles"); }); test("setup keeps the compact shell and its dialog opener without an inline form", () => { const html = renderToStaticMarkup(
, ); expect(html).toContain('data-state="setup"'); expect(html.match(/

/g)).toHaveLength(1); expect(html).not.toContain('aria-label="Skill review"'); expect(html).toContain('aria-haspopup="dialog"'); expect(html).toContain('aria-expanded="true"'); expect(html).toContain(">Review skill"); }); test("completed Skill state uses the shared completion shell and removes setup actions and disclaimer", () => { const html = renderToStaticMarkup(); expect(html).toContain('role="status"'); expect(html).toContain("Installed · Workspace"); expect(html).toContain('data-state="complete"'); expect(html).toContain("og-session-capability-shell"); expect(html).not.toContain(" { const html = renderToStaticMarkup(); expect(html).toContain("Connected · Available in this conversation"); expect(html).not.toContain("agent continues"); }); test("provider-specific completion copy and a busy opener stay truthful", () => { const connected = renderToStaticMarkup( , ); expect(connected).toContain("Connected to this workspace"); expect(connected).not.toContain("Available in this conversation"); const opening = renderToStaticMarkup( , ); expect(opening).toContain("Opening GitHub…"); expect(opening).toContain('disabled=""'); expect(opening).not.toContain('aria-haspopup="dialog"'); }); test("an unavailable action is explained in place of the button", () => { const html = renderToStaticMarkup( , ); expect(html).toContain("Only workspace admins can connect GitHub."); expect(html).toContain('role="note"'); expect(html).not.toContain(" { for (const complete of [false, true]) { const html = renderToStaticMarkup( } />, ); const shell = html.slice( html.indexOf("og-session-capability-shell"), html.indexOf(""), ); expect(shell).toContain("data-details"); } }); });