diff --git a/extensions/feishu/src/monitor.startup.test.ts b/extensions/feishu/src/monitor.startup.test.ts index 54ad94620ea..18e5d7758ea 100644 --- a/extensions/feishu/src/monitor.startup.test.ts +++ b/extensions/feishu/src/monitor.startup.test.ts @@ -1,10 +1,6 @@ import type { ClawdbotConfig } from "openclaw/plugin-sdk/feishu"; import { afterEach, describe, expect, it, vi } from "vitest"; import { monitorFeishuProvider, stopFeishuMonitor } from "./monitor.js"; -import { - createFeishuClientMockModule, - createFeishuRuntimeMockModule, -} from "./monitor.test-mocks.js"; const probeFeishuMock = vi.hoisted(() => vi.fn()); @@ -12,8 +8,26 @@ vi.mock("./probe.js", () => ({ probeFeishu: probeFeishuMock, })); -vi.mock("./client.js", () => createFeishuClientMockModule()); -vi.mock("./runtime.js", () => createFeishuRuntimeMockModule()); +vi.mock("./client.js", () => ({ + createFeishuWSClient: vi.fn(() => ({ start: vi.fn() })), + createEventDispatcher: vi.fn(() => ({ register: vi.fn() })), +})); +vi.mock("./runtime.js", () => ({ + getFeishuRuntime: () => ({ + channel: { + debounce: { + resolveInboundDebounceMs: () => 0, + createInboundDebouncer: () => ({ + enqueue: async () => {}, + flushKey: async () => {}, + }), + }, + text: { + hasControlCommand: () => false, + }, + }, + }), +})); function buildMultiAccountWebsocketConfig(accountIds: string[]): ClawdbotConfig { return { diff --git a/src/infra/net/proxy-fetch.test.ts b/src/infra/net/proxy-fetch.test.ts index 52e2ce7a278..4bc7904e2dd 100644 --- a/src/infra/net/proxy-fetch.test.ts +++ b/src/infra/net/proxy-fetch.test.ts @@ -51,7 +51,12 @@ vi.mock("undici", () => ({ fetch: undiciFetch, })); -import { getProxyUrlFromFetch, makeProxyFetch, resolveProxyFetchFromEnv } from "./proxy-fetch.js"; +import { + getProxyUrlFromFetch, + makeProxyFetch, + PROXY_FETCH_PROXY_URL, + resolveProxyFetchFromEnv, +} from "./proxy-fetch.js"; function clearProxyEnv(): void { for (const key of PROXY_ENV_KEYS) { @@ -112,9 +117,9 @@ describe("getProxyUrlFromFetch", () => { it("returns undefined for plain fetch functions or blank metadata", () => { const plainFetch = vi.fn() as unknown as typeof fetch; const blankMetadataFetch = vi.fn() as unknown as typeof fetch & { - [Symbol.for("openclaw.proxyFetch.proxyUrl")]?: string; + [PROXY_FETCH_PROXY_URL]?: string; }; - blankMetadataFetch[Symbol.for("openclaw.proxyFetch.proxyUrl")] = " "; + blankMetadataFetch[PROXY_FETCH_PROXY_URL] = " "; expect(getProxyUrlFromFetch(plainFetch)).toBeUndefined(); expect(getProxyUrlFromFetch(blankMetadataFetch)).toBeUndefined(); diff --git a/src/infra/pairing-files.test.ts b/src/infra/pairing-files.test.ts index 8f891036956..ad3ac504fac 100644 --- a/src/infra/pairing-files.test.ts +++ b/src/infra/pairing-files.test.ts @@ -1,3 +1,4 @@ +import path from "node:path"; import { describe, expect, it, vi } from "vitest"; import { pruneExpiredPending, @@ -8,9 +9,9 @@ import { describe("pairing file helpers", () => { it("resolves pairing file paths from explicit base dirs", () => { expect(resolvePairingPaths("/tmp/openclaw-state", "devices")).toEqual({ - dir: "/tmp/openclaw-state/devices", - pendingPath: "/tmp/openclaw-state/devices/pending.json", - pairedPath: "/tmp/openclaw-state/devices/paired.json", + dir: path.join("/tmp/openclaw-state", "devices"), + pendingPath: path.join("/tmp/openclaw-state", "devices", "pending.json"), + pairedPath: path.join("/tmp/openclaw-state", "devices", "paired.json"), }); });