import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it } from "vitest"; import { AIConfigDiffReviewPanel } from "./AIConfigDiffReviewPanel"; import { PluginLifecycleWorkbench } from "./PluginLifecycleWorkbench"; import lifecycleSource from "./PluginLifecycleWorkbench.tsx?raw"; import diffSource from "./AIConfigDiffReviewPanel.tsx?raw"; describe("plugin operations components", () => { it("renders persisted loading states without optimistic terminal success", () => { expect(renderToStaticMarkup()).toContain("正在同步插件生命周期"); expect(renderToStaticMarkup()).toContain("正在同步 AI 配置差异"); for (const source of [lifecycleSource, diffSource]) { expect(source).not.toContain("setTimeout"); expect(source).not.toMatch(/apiKeyRef|rawApiKey|runSocket|providerBaseUrl|hostPath|directRun/i); expect(source).toContain("disabled="); } expect(lifecycleSource).toContain("if (!selectedServerId || busy) return"); expect(diffSource).toContain("if (!selected || busyId) return"); }); });