mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(ci): stabilize tests and detect-secrets after dep updates
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
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());
|
||||
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", () => ({
|
||||
probeFeishu: probeFeishuMock,
|
||||
}));
|
||||
|
||||
vi.mock("./client.js", () => createFeishuClientMockModule());
|
||||
vi.mock("./runtime.js", () => createFeishuRuntimeMockModule());
|
||||
vi.mock("./client.js", () => feishuClientMockModule);
|
||||
vi.mock("./runtime.js", () => feishuRuntimeMockModule);
|
||||
|
||||
function buildMultiAccountWebsocketConfig(accountIds: string[]): ClawdbotConfig {
|
||||
return {
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
import { vi } from "vitest";
|
||||
|
||||
export function createFeishuClientMockModule() {
|
||||
export function createFeishuClientMockModule(): {
|
||||
createFeishuWSClient: () => { start: () => void };
|
||||
createEventDispatcher: () => { register: () => void };
|
||||
} {
|
||||
return {
|
||||
createFeishuWSClient: vi.fn(() => ({ start: vi.fn() })),
|
||||
createEventDispatcher: vi.fn(() => ({ register: vi.fn() })),
|
||||
};
|
||||
}
|
||||
|
||||
export function createFeishuRuntimeMockModule() {
|
||||
export function createFeishuRuntimeMockModule(): {
|
||||
getFeishuRuntime: () => {
|
||||
channel: {
|
||||
debounce: {
|
||||
resolveInboundDebounceMs: () => number;
|
||||
createInboundDebouncer: () => {
|
||||
enqueue: () => Promise<void>;
|
||||
flushKey: () => Promise<void>;
|
||||
};
|
||||
};
|
||||
text: {
|
||||
hasControlCommand: () => boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
} {
|
||||
return {
|
||||
getFeishuRuntime: () => ({
|
||||
channel: {
|
||||
|
||||
Reference in New Issue
Block a user