fix(ci): stabilize tests and detect-secrets after dep updates

This commit is contained in:
Peter Steinberger
2026-03-07 11:13:55 +00:00
parent ac63f30cd2
commit addd290f88
7 changed files with 69 additions and 33 deletions

View File

@@ -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 {

View File

@@ -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: {