refactor: finish test cleanup off infra runtime

This commit is contained in:
Peter Steinberger
2026-03-28 06:59:32 +00:00
parent 5802d112da
commit f4cd06cb1a
3 changed files with 3 additions and 16 deletions

View File

@@ -905,8 +905,8 @@ const { enqueueSystemEventSpy, resolveAgentRouteMock } = vi.hoisted(() => ({
})), })),
})); }));
const infraRuntimeModule = await import("openclaw/plugin-sdk/infra-runtime"); const channelRuntimeModule = await import("openclaw/plugin-sdk/channel-runtime");
vi.spyOn(infraRuntimeModule, "enqueueSystemEvent").mockImplementation(enqueueSystemEventSpy); vi.spyOn(channelRuntimeModule, "enqueueSystemEvent").mockImplementation(enqueueSystemEventSpy);
const routingModule = await import("openclaw/plugin-sdk/routing"); const routingModule = await import("openclaw/plugin-sdk/routing");
vi.spyOn(routingModule, "resolveAgentRoute").mockImplementation(resolveAgentRouteMock); vi.spyOn(routingModule, "resolveAgentRoute").mockImplementation(resolveAgentRouteMock);

View File

@@ -64,19 +64,6 @@ const resolveStorePathMock = vi.hoisted(() => vi.fn());
const dispatchPluginInteractiveHandlerMock = vi.hoisted(() => vi.fn()); const dispatchPluginInteractiveHandlerMock = vi.hoisted(() => vi.fn());
let lastDispatchCtx: Record<string, unknown> | undefined; let lastDispatchCtx: Record<string, unknown> | undefined;
async function createInfraRuntimeMock(
importOriginal: () => Promise<typeof import("openclaw/plugin-sdk/infra-runtime")>,
) {
const actual = await importOriginal();
return {
...actual,
enqueueSystemEvent: (...args: unknown[]) => enqueueSystemEventMock(...args),
};
}
vi.mock("openclaw/plugin-sdk/infra-runtime", createInfraRuntimeMock);
vi.mock("openclaw/plugin-sdk/infra-runtime.js", createInfraRuntimeMock);
async function createChannelRuntimeMock( async function createChannelRuntimeMock(
importOriginal: () => Promise<typeof import("openclaw/plugin-sdk/channel-runtime")>, importOriginal: () => Promise<typeof import("openclaw/plugin-sdk/channel-runtime")>,
) { ) {

View File

@@ -291,7 +291,7 @@ describe("memory plugin e2e", () => {
dimensions: 1024, dimensions: 1024,
}); });
} finally { } finally {
vi.doUnmock("openclaw/plugin-sdk/infra-runtime"); vi.doUnmock("openclaw/plugin-sdk/runtime-env");
vi.doUnmock("openai"); vi.doUnmock("openai");
vi.doUnmock("./lancedb-runtime.js"); vi.doUnmock("./lancedb-runtime.js");
vi.resetModules(); vi.resetModules();