mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 17:20:22 +00:00
test(feishu): avoid loading bot and send modules in menu tests
This commit is contained in:
@@ -8,7 +8,9 @@ const createEventDispatcherMock = vi.hoisted(() => vi.fn());
|
|||||||
const monitorWebSocketMock = vi.hoisted(() => vi.fn(async () => {}));
|
const monitorWebSocketMock = vi.hoisted(() => vi.fn(async () => {}));
|
||||||
const monitorWebhookMock = vi.hoisted(() => vi.fn(async () => {}));
|
const monitorWebhookMock = vi.hoisted(() => vi.fn(async () => {}));
|
||||||
const handleFeishuMessageMock = vi.hoisted(() => vi.fn(async () => {}));
|
const handleFeishuMessageMock = vi.hoisted(() => vi.fn(async () => {}));
|
||||||
|
const parseFeishuMessageEventMock = vi.hoisted(() => vi.fn());
|
||||||
const sendCardFeishuMock = vi.hoisted(() => vi.fn(async () => ({ messageId: "m1", chatId: "c1" })));
|
const sendCardFeishuMock = vi.hoisted(() => vi.fn(async () => ({ messageId: "m1", chatId: "c1" })));
|
||||||
|
const getMessageFeishuMock = vi.hoisted(() => vi.fn());
|
||||||
const createFeishuThreadBindingManagerMock = vi.hoisted(() => vi.fn(() => ({ stop: vi.fn() })));
|
const createFeishuThreadBindingManagerMock = vi.hoisted(() => vi.fn(() => ({ stop: vi.fn() })));
|
||||||
|
|
||||||
let handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
let handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
||||||
@@ -41,19 +43,17 @@ vi.mock("./monitor.transport.js", () => ({
|
|||||||
monitorWebhook: monitorWebhookMock,
|
monitorWebhook: monitorWebhookMock,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("./bot.js", async () => {
|
vi.mock("./bot.js", () => {
|
||||||
const actual = await vi.importActual<typeof import("./bot.js")>("./bot.js");
|
|
||||||
return {
|
return {
|
||||||
...actual,
|
|
||||||
handleFeishuMessage: handleFeishuMessageMock,
|
handleFeishuMessage: handleFeishuMessageMock,
|
||||||
|
parseFeishuMessageEvent: parseFeishuMessageEventMock,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.mock("./send.js", async () => {
|
vi.mock("./send.js", () => {
|
||||||
const actual = await vi.importActual<typeof import("./send.js")>("./send.js");
|
|
||||||
return {
|
return {
|
||||||
...actual,
|
|
||||||
sendCardFeishu: sendCardFeishuMock,
|
sendCardFeishu: sendCardFeishuMock,
|
||||||
|
getMessageFeishu: getMessageFeishuMock,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user