mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 10:50:58 +00:00
refactor: finish test cleanup off infra runtime
This commit is contained in:
@@ -905,8 +905,8 @@ const { enqueueSystemEventSpy, resolveAgentRouteMock } = vi.hoisted(() => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
const infraRuntimeModule = await import("openclaw/plugin-sdk/infra-runtime");
|
||||
vi.spyOn(infraRuntimeModule, "enqueueSystemEvent").mockImplementation(enqueueSystemEventSpy);
|
||||
const channelRuntimeModule = await import("openclaw/plugin-sdk/channel-runtime");
|
||||
vi.spyOn(channelRuntimeModule, "enqueueSystemEvent").mockImplementation(enqueueSystemEventSpy);
|
||||
|
||||
const routingModule = await import("openclaw/plugin-sdk/routing");
|
||||
vi.spyOn(routingModule, "resolveAgentRoute").mockImplementation(resolveAgentRouteMock);
|
||||
|
||||
@@ -64,19 +64,6 @@ const resolveStorePathMock = vi.hoisted(() => vi.fn());
|
||||
const dispatchPluginInteractiveHandlerMock = vi.hoisted(() => vi.fn());
|
||||
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(
|
||||
importOriginal: () => Promise<typeof import("openclaw/plugin-sdk/channel-runtime")>,
|
||||
) {
|
||||
|
||||
@@ -291,7 +291,7 @@ describe("memory plugin e2e", () => {
|
||||
dimensions: 1024,
|
||||
});
|
||||
} finally {
|
||||
vi.doUnmock("openclaw/plugin-sdk/infra-runtime");
|
||||
vi.doUnmock("openclaw/plugin-sdk/runtime-env");
|
||||
vi.doUnmock("openai");
|
||||
vi.doUnmock("./lancedb-runtime.js");
|
||||
vi.resetModules();
|
||||
|
||||
Reference in New Issue
Block a user