mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 23:22:32 +00:00
tests(feishu): reload chat tool after mock reset
This commit is contained in:
@@ -2,7 +2,6 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createTestPluginApi } from "../../../test/helpers/extensions/plugin-api.js";
|
||||
import { createPluginRuntimeMock } from "../../../test/helpers/extensions/plugin-runtime-mock.js";
|
||||
import type { OpenClawPluginApi } from "../runtime-api.js";
|
||||
import { registerFeishuChatTools } from "./chat.js";
|
||||
|
||||
const createFeishuClientMock = vi.hoisted(() => vi.fn());
|
||||
const chatGetMock = vi.hoisted(() => vi.fn());
|
||||
@@ -13,6 +12,8 @@ vi.mock("./client.js", () => ({
|
||||
createFeishuClient: createFeishuClientMock,
|
||||
}));
|
||||
|
||||
let registerFeishuChatTools: typeof import("./chat.js").registerFeishuChatTools;
|
||||
|
||||
describe("registerFeishuChatTools", () => {
|
||||
function createChatToolApi(params: {
|
||||
config: OpenClawPluginApi["config"];
|
||||
@@ -30,6 +31,7 @@ describe("registerFeishuChatTools", () => {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetModules();
|
||||
vi.clearAllMocks();
|
||||
createFeishuClientMock.mockReturnValue({
|
||||
im: {
|
||||
@@ -42,6 +44,10 @@ describe("registerFeishuChatTools", () => {
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
({ registerFeishuChatTools } = await import("./chat.js"));
|
||||
});
|
||||
|
||||
it("registers feishu_chat and handles info/members actions", async () => {
|
||||
const registerTool = vi.fn();
|
||||
registerFeishuChatTools(
|
||||
|
||||
Reference in New Issue
Block a user