test(discord): fix monitor test typings

This commit is contained in:
Peter Steinberger
2026-02-26 04:35:49 +01:00
parent e35fe7888b
commit 02c731826a
2 changed files with 10 additions and 5 deletions

View File

@@ -55,8 +55,15 @@ describe("runDiscordGatewayLifecycle", () => {
const start = vi.fn(params?.start ?? (async () => undefined));
const stop = vi.fn(params?.stop ?? (async () => undefined));
const threadStop = vi.fn();
const runtimeLog = vi.fn();
const runtimeError = vi.fn();
const runtimeExit = vi.fn();
const releaseEarlyGatewayErrorGuard = vi.fn();
const runtime: RuntimeEnv = {
log: runtimeLog,
error: runtimeError,
exit: runtimeExit,
};
return {
start,
stop,
@@ -66,9 +73,7 @@ describe("runDiscordGatewayLifecycle", () => {
lifecycleParams: {
accountId: params?.accountId ?? "default",
client: { getPlugin: vi.fn(() => undefined) } as unknown as Client,
runtime: {
error: runtimeError,
} as RuntimeEnv,
runtime,
isDisallowedIntentsError: params?.isDisallowedIntentsError ?? (() => false),
voiceManager: null,
voiceManagerRef: { current: null },

View File

@@ -20,8 +20,8 @@ const {
} = vi.hoisted(() => {
const createdBindingManagers: Array<{ stop: ReturnType<typeof vi.fn> }> = [];
return {
clientFetchUserMock: vi.fn(async () => ({ id: "bot-1" })),
clientGetPluginMock: vi.fn(() => undefined),
clientFetchUserMock: vi.fn(async (_target: string) => ({ id: "bot-1" })),
clientGetPluginMock: vi.fn<(_name: string) => unknown>(() => undefined),
createDiscordNativeCommandMock: vi.fn(() => ({ name: "mock-command" })),
createNoopThreadBindingManagerMock: vi.fn(() => {
const manager = { stop: vi.fn() };