mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 03:31:10 +00:00
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const loadBundledPluginPublicSurfaceModuleSync = vi.hoisted(() => vi.fn());
|
|
const registerQaLabCliImpl = vi.hoisted(() => vi.fn());
|
|
|
|
vi.mock("./facade-loader.js", async () => {
|
|
const actual = await vi.importActual<typeof import("./facade-loader.js")>("./facade-loader.js");
|
|
return {
|
|
...actual,
|
|
loadBundledPluginPublicSurfaceModuleSync,
|
|
};
|
|
});
|
|
|
|
describe("plugin-sdk qa-lab", () => {
|
|
beforeEach(() => {
|
|
registerQaLabCliImpl.mockReset();
|
|
loadBundledPluginPublicSurfaceModuleSync.mockReset().mockReturnValue({
|
|
registerQaLabCli: registerQaLabCliImpl,
|
|
});
|
|
});
|
|
|
|
it("keeps the qa-lab facade cold until used", async () => {
|
|
const module = await import("./qa-lab.js");
|
|
|
|
expect(loadBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled();
|
|
module.registerQaLabCli({} as never);
|
|
expect(loadBundledPluginPublicSurfaceModuleSync).toHaveBeenCalledWith({
|
|
dirName: "qa-lab",
|
|
artifactBasename: "api.js",
|
|
});
|
|
});
|
|
|
|
it("delegates qa cli registration through the bundled public surface", async () => {
|
|
const module = await import("./qa-lab.js");
|
|
|
|
module.registerQaLabCli({} as never);
|
|
expect(registerQaLabCliImpl).toHaveBeenCalledWith({} as never);
|
|
});
|
|
});
|