oclaw/openclaw/test/vitest-light-paths.test.ts
oliver dbbe3add6a 重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
2026-04-26 08:34:33 +08:00

47 lines
2.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
isCommandsLightTarget,
resolveCommandsLightIncludePattern,
} from "./vitest/vitest.commands-light-paths.mjs";
import {
isPluginSdkLightTarget,
resolvePluginSdkLightIncludePattern,
} from "./vitest/vitest.plugin-sdk-paths.mjs";
describe("light vitest path routing", () => {
it("maps plugin-sdk allowlist source and test files to sibling light tests", () => {
expect(isPluginSdkLightTarget("src/plugin-sdk/lazy-value.ts")).toBe(true);
expect(isPluginSdkLightTarget("src/plugin-sdk/lazy-value.test.ts")).toBe(true);
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/lazy-value.ts")).toBe(
"src/plugin-sdk/lazy-value.test.ts",
);
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/lazy-value.test.ts")).toBe(
"src/plugin-sdk/lazy-value.test.ts",
);
});
it("keeps non-allowlisted plugin-sdk files off the light lane", () => {
expect(isPluginSdkLightTarget("src/plugin-sdk/facade-runtime.ts")).toBe(false);
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/facade-runtime.ts")).toBeNull();
});
it("maps commands allowlist source and test files to sibling light tests", () => {
expect(isCommandsLightTarget("src/commands/text-format.ts")).toBe(true);
expect(isCommandsLightTarget("src/commands/text-format.test.ts")).toBe(true);
expect(resolveCommandsLightIncludePattern("src/commands/text-format.ts")).toBe(
"src/commands/text-format.test.ts",
);
expect(resolveCommandsLightIncludePattern("src/commands/text-format.test.ts")).toBe(
"src/commands/text-format.test.ts",
);
expect(isCommandsLightTarget("src/commands/gateway-status/helpers.ts")).toBe(true);
expect(resolveCommandsLightIncludePattern("src/commands/gateway-status/helpers.ts")).toBe(
"src/commands/gateway-status/helpers.test.ts",
);
});
it("keeps non-allowlisted commands files off the light lane", () => {
expect(isCommandsLightTarget("src/commands/channels.add.ts")).toBe(false);
expect(resolveCommandsLightIncludePattern("src/commands/channels.add.ts")).toBeNull();
});
});