mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:22:45 +00:00
test(discord): fix monitor test typings
This commit is contained in:
@@ -55,8 +55,15 @@ describe("runDiscordGatewayLifecycle", () => {
|
|||||||
const start = vi.fn(params?.start ?? (async () => undefined));
|
const start = vi.fn(params?.start ?? (async () => undefined));
|
||||||
const stop = vi.fn(params?.stop ?? (async () => undefined));
|
const stop = vi.fn(params?.stop ?? (async () => undefined));
|
||||||
const threadStop = vi.fn();
|
const threadStop = vi.fn();
|
||||||
|
const runtimeLog = vi.fn();
|
||||||
const runtimeError = vi.fn();
|
const runtimeError = vi.fn();
|
||||||
|
const runtimeExit = vi.fn();
|
||||||
const releaseEarlyGatewayErrorGuard = vi.fn();
|
const releaseEarlyGatewayErrorGuard = vi.fn();
|
||||||
|
const runtime: RuntimeEnv = {
|
||||||
|
log: runtimeLog,
|
||||||
|
error: runtimeError,
|
||||||
|
exit: runtimeExit,
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
start,
|
start,
|
||||||
stop,
|
stop,
|
||||||
@@ -66,9 +73,7 @@ describe("runDiscordGatewayLifecycle", () => {
|
|||||||
lifecycleParams: {
|
lifecycleParams: {
|
||||||
accountId: params?.accountId ?? "default",
|
accountId: params?.accountId ?? "default",
|
||||||
client: { getPlugin: vi.fn(() => undefined) } as unknown as Client,
|
client: { getPlugin: vi.fn(() => undefined) } as unknown as Client,
|
||||||
runtime: {
|
runtime,
|
||||||
error: runtimeError,
|
|
||||||
} as RuntimeEnv,
|
|
||||||
isDisallowedIntentsError: params?.isDisallowedIntentsError ?? (() => false),
|
isDisallowedIntentsError: params?.isDisallowedIntentsError ?? (() => false),
|
||||||
voiceManager: null,
|
voiceManager: null,
|
||||||
voiceManagerRef: { current: null },
|
voiceManagerRef: { current: null },
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ const {
|
|||||||
} = vi.hoisted(() => {
|
} = vi.hoisted(() => {
|
||||||
const createdBindingManagers: Array<{ stop: ReturnType<typeof vi.fn> }> = [];
|
const createdBindingManagers: Array<{ stop: ReturnType<typeof vi.fn> }> = [];
|
||||||
return {
|
return {
|
||||||
clientFetchUserMock: vi.fn(async () => ({ id: "bot-1" })),
|
clientFetchUserMock: vi.fn(async (_target: string) => ({ id: "bot-1" })),
|
||||||
clientGetPluginMock: vi.fn(() => undefined),
|
clientGetPluginMock: vi.fn<(_name: string) => unknown>(() => undefined),
|
||||||
createDiscordNativeCommandMock: vi.fn(() => ({ name: "mock-command" })),
|
createDiscordNativeCommandMock: vi.fn(() => ({ name: "mock-command" })),
|
||||||
createNoopThreadBindingManagerMock: vi.fn(() => {
|
createNoopThreadBindingManagerMock: vi.fn(() => {
|
||||||
const manager = { stop: vi.fn() };
|
const manager = { stop: vi.fn() };
|
||||||
|
|||||||
Reference in New Issue
Block a user