






























@@ -176,9 +176,9 @@ describe("createDiscordMonitorClient", () => {
176176});
177177178178expect(registerVoiceClientSpy).toHaveBeenCalledTimes(1);
179-expect(result.client.listeners).toEqual(
180-expect.arrayContaining([expect.objectContaining({ type: "voice-listener" })]),
181-);
179+expect(
180+result.client.listeners.map((listener) => (listener as { type?: string }).type),
181+).toContain("voice-listener");
182182});
183183184184it("waits for gateway registration before creating the supervisor", async () => {
@@ -239,17 +239,15 @@ describe("createDiscordMonitorClient", () => {
239239isDisallowedIntentsError: () => false,
240240});
241241242-expect(createClient).toHaveBeenCalledWith(
243-expect.objectContaining({
244-requestOptions: {
245-timeout: DISCORD_REST_TIMEOUT_MS,
246-runtimeProfile: "persistent",
247-maxQueueSize: 1000,
248-},
249-}),
250-expect.any(Object),
251-expect.any(Array),
252-);
242+expect(createClient).toHaveBeenCalledTimes(1);
243+const [options, handlers, plugins] = createClient.mock.calls[0] ?? [];
244+expect(options?.requestOptions).toEqual({
245+timeout: DISCORD_REST_TIMEOUT_MS,
246+runtimeProfile: "persistent",
247+maxQueueSize: 1000,
248+});
249+expect(handlers).toBeDefined();
250+expect(Array.isArray(plugins)).toBe(true);
253251});
254252255253it("passes REST timeout options and fetch to internal Discord REST", async () => {
@@ -274,18 +272,16 @@ describe("createDiscordMonitorClient", () => {
274272isDisallowedIntentsError: () => false,
275273});
276274277-expect(createClient).toHaveBeenCalledWith(
278-expect.objectContaining({
279-requestOptions: {
280-timeout: DISCORD_REST_TIMEOUT_MS,
281-runtimeProfile: "persistent",
282-maxQueueSize: 1000,
283-fetch: restFetch,
284-},
285-}),
286-expect.any(Object),
287-expect.any(Array),
288-);
275+expect(createClient).toHaveBeenCalledTimes(1);
276+const [options, handlers, plugins] = createClient.mock.calls[0] ?? [];
277+expect(options?.requestOptions).toEqual({
278+timeout: DISCORD_REST_TIMEOUT_MS,
279+runtimeProfile: "persistent",
280+maxQueueSize: 1000,
281+fetch: restFetch,
282+});
283+expect(handlers).toBeDefined();
284+expect(Array.isArray(plugins)).toBe(true);
289285});
290286291287it("propagates gateway registration failures before supervisor startup", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。