mirror of https://github.com/openclaw/openclaw.git
test: share feishu monitor startup mocks
This commit is contained in:
parent
0f8531dea6
commit
4df8722edf
|
|
@ -1,35 +1,19 @@
|
||||||
import type { ClawdbotConfig } from "openclaw/plugin-sdk/feishu";
|
import type { ClawdbotConfig } from "openclaw/plugin-sdk/feishu";
|
||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import { monitorFeishuProvider, stopFeishuMonitor } from "./monitor.js";
|
import { monitorFeishuProvider, stopFeishuMonitor } from "./monitor.js";
|
||||||
|
import {
|
||||||
|
createFeishuClientMockModule,
|
||||||
|
createFeishuRuntimeMockModule,
|
||||||
|
} from "./monitor.test-mocks.js";
|
||||||
|
|
||||||
const probeFeishuMock = vi.hoisted(() => vi.fn());
|
const probeFeishuMock = vi.hoisted(() => vi.fn());
|
||||||
const feishuClientMockModule = vi.hoisted(() => ({
|
|
||||||
createFeishuWSClient: vi.fn(() => ({ start: vi.fn() })),
|
|
||||||
createEventDispatcher: vi.fn(() => ({ register: vi.fn() })),
|
|
||||||
}));
|
|
||||||
const feishuRuntimeMockModule = vi.hoisted(() => ({
|
|
||||||
getFeishuRuntime: () => ({
|
|
||||||
channel: {
|
|
||||||
debounce: {
|
|
||||||
resolveInboundDebounceMs: () => 0,
|
|
||||||
createInboundDebouncer: () => ({
|
|
||||||
enqueue: async () => {},
|
|
||||||
flushKey: async () => {},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
hasControlCommand: () => false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
vi.mock("./probe.js", () => ({
|
vi.mock("./probe.js", () => ({
|
||||||
probeFeishu: probeFeishuMock,
|
probeFeishu: probeFeishuMock,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("./client.js", () => feishuClientMockModule);
|
vi.mock("./client.js", () => createFeishuClientMockModule());
|
||||||
vi.mock("./runtime.js", () => feishuRuntimeMockModule);
|
vi.mock("./runtime.js", () => createFeishuRuntimeMockModule());
|
||||||
|
|
||||||
function buildMultiAccountWebsocketConfig(accountIds: string[]): ClawdbotConfig {
|
function buildMultiAccountWebsocketConfig(accountIds: string[]): ClawdbotConfig {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue