import { describe, expect, test } from "bun:test"; import { parseWorkbenchNativeRuntimeConfig } from "../vite.config"; const validConfig = { displayTime: { timeZone: "Asia/Shanghai", locale: "zh-CN", label: "北京时间" }, workbench: { realtimeFeatures: { liveKafkaSse: false, kafkaRefreshReplay: false, projectionRealtime: true }, debugCapabilities: { isolatedKafka: false, rawHwlabEventWindow: { enabled: false, maxEntries: 1, maxRetainedBytes: 1 } }, traceTimeline: { autoExpandRunning: false, autoCollapseTerminal: false } } }; describe("Workbench native Vite runtime config", () => { test("accepts the YAML-rendered runtime contract", () => { expect(parseWorkbenchNativeRuntimeConfig(JSON.stringify(validConfig))).toEqual(validConfig); }); test("fails closed when required runtime capabilities are missing", () => { expect(() => parseWorkbenchNativeRuntimeConfig(JSON.stringify({ displayTime: validConfig.displayTime, workbench: {} }))).toThrow("workbench.realtimeFeatures"); }); });