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