mirror of https://github.com/openclaw/openclaw.git
fix(test): align channel mocks with runtime exports
This commit is contained in:
parent
da35718cb2
commit
d28349c48e
|
|
@ -5,7 +5,7 @@ import type { ModelsProviderData } from "openclaw/plugin-sdk/command-auth";
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import * as dispatcherModule from "openclaw/plugin-sdk/reply-runtime";
|
||||
import * as globalsModule from "openclaw/plugin-sdk/runtime-env";
|
||||
import * as timeoutModule from "openclaw/plugin-sdk/runtime-env";
|
||||
import * as commandTextModule from "openclaw/plugin-sdk/text-runtime";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import * as modelPickerPreferencesModule from "./model-picker-preferences.js";
|
||||
import * as modelPickerModule from "./model-picker.js";
|
||||
|
|
@ -331,7 +331,7 @@ describe("Discord model picker interactions", () => {
|
|||
.mockResolvedValue();
|
||||
const dispatchSpy = createDispatchSpy();
|
||||
const withTimeoutSpy = vi
|
||||
.spyOn(timeoutModule, "withTimeout")
|
||||
.spyOn(commandTextModule, "withTimeout")
|
||||
.mockRejectedValue(new Error("timeout"));
|
||||
|
||||
await runModelSelect({ context });
|
||||
|
|
|
|||
|
|
@ -41,14 +41,6 @@ vi.mock("../../../../src/channels/plugins/whatsapp-heartbeat.js", () => ({
|
|||
resolveWhatsAppHeartbeatRecipients: () => [],
|
||||
}));
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/config-runtime", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/config-runtime")>();
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: () => ({ agents: { defaults: {} }, session: {} }),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/routing", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/routing")>();
|
||||
return {
|
||||
|
|
@ -91,18 +83,27 @@ vi.mock("openclaw/plugin-sdk/text-runtime", async (importOriginal) => {
|
|||
};
|
||||
});
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/reply-runtime", () => ({
|
||||
getReplyFromConfig: vi.fn(async () => undefined),
|
||||
}));
|
||||
vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/reply-runtime")>();
|
||||
return {
|
||||
...actual,
|
||||
getReplyFromConfig: vi.fn(async () => undefined),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/config-runtime", () => ({
|
||||
loadSessionStore: () => state.store,
|
||||
resolveSessionKey: () => "k",
|
||||
resolveStorePath: () => "/tmp/store.json",
|
||||
updateSessionStore: async (_path: string, updater: (store: typeof state.store) => void) => {
|
||||
updater(state.store);
|
||||
},
|
||||
}));
|
||||
vi.mock("openclaw/plugin-sdk/config-runtime", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/config-runtime")>();
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: () => ({ agents: { defaults: {} }, session: {} }),
|
||||
loadSessionStore: () => state.store,
|
||||
resolveSessionKey: () => "k",
|
||||
resolveStorePath: () => "/tmp/store.json",
|
||||
updateSessionStore: async (_path: string, updater: (store: typeof state.store) => void) => {
|
||||
updater(state.store);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("./session-snapshot.js", () => ({
|
||||
getSessionSnapshot: () => state.snapshot,
|
||||
|
|
|
|||
Loading…
Reference in New Issue