Files
openclaw/extensions/feishu/src/monitor.test-mocks.ts
Lin Z bd4237c16c fix(feishu): close WebSocket connections on monitor stop (#52844)
* fix(feishu): close WebSocket connections on monitor stop/abort

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(feishu): add WebSocket cleanup tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(feishu): close WebSocket connections on monitor stop (#52844) (thanks @schumilin)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
2026-03-25 08:32:21 -07:00

46 lines
1.1 KiB
TypeScript

import { vi } from "vitest";
export function createFeishuClientMockModule(): {
createFeishuWSClient: () => { start: () => void; close: () => void };
createEventDispatcher: () => { register: () => void };
} {
return {
createFeishuWSClient: vi.fn(() => ({ start: vi.fn(), close: vi.fn() })),
createEventDispatcher: vi.fn(() => ({ register: vi.fn() })),
};
}
export function createFeishuRuntimeMockModule(): {
getFeishuRuntime: () => {
channel: {
debounce: {
resolveInboundDebounceMs: () => number;
createInboundDebouncer: () => {
enqueue: () => Promise<void>;
flushKey: () => Promise<void>;
};
};
text: {
hasControlCommand: () => boolean;
};
};
};
} {
return {
getFeishuRuntime: () => ({
channel: {
debounce: {
resolveInboundDebounceMs: () => 0,
createInboundDebouncer: () => ({
enqueue: async () => {},
flushKey: async () => {},
}),
},
text: {
hasControlCommand: () => false,
},
},
}),
};
}