From d10fd6b8f48de77628ce49e99cd4e24e809f85a0 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 29 May 2026 16:38:29 -0400 Subject: [PATCH] test: fix timeout mock return types --- extensions/mattermost/src/mattermost/client.retry.test.ts | 2 +- extensions/xiaomi/speech-provider.test.ts | 2 +- extensions/zai/detect.test.ts | 2 +- extensions/zalo/src/api.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/mattermost/src/mattermost/client.retry.test.ts b/extensions/mattermost/src/mattermost/client.retry.test.ts index 7e63f160100..a4e8c1e67a2 100644 --- a/extensions/mattermost/src/mattermost/client.retry.test.ts +++ b/extensions/mattermost/src/mattermost/client.retry.test.ts @@ -355,7 +355,7 @@ describe("createMattermostDirectChannelWithRetry", () => { it("caps oversized request timeouts before scheduling aborts", async () => { const timeoutSpy = vi .spyOn(globalThis, "setTimeout") - .mockImplementation((() => 1) as typeof setTimeout); + .mockReturnValue(1 as unknown as ReturnType); vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined); mockFetch.mockResolvedValueOnce({ ok: true, diff --git a/extensions/xiaomi/speech-provider.test.ts b/extensions/xiaomi/speech-provider.test.ts index 1a613a57238..47004d7980b 100644 --- a/extensions/xiaomi/speech-provider.test.ts +++ b/extensions/xiaomi/speech-provider.test.ts @@ -214,7 +214,7 @@ describe("buildXiaomiSpeechProvider", () => { const audio = Buffer.from("fake-mp3-audio").toString("base64"); const timeoutSpy = vi .spyOn(globalThis, "setTimeout") - .mockImplementation((() => 1) as typeof setTimeout); + .mockReturnValue(1 as unknown as ReturnType); const clearTimeoutSpy = vi .spyOn(globalThis, "clearTimeout") .mockImplementation(() => undefined); diff --git a/extensions/zai/detect.test.ts b/extensions/zai/detect.test.ts index 386b97b6094..690dd3d105e 100644 --- a/extensions/zai/detect.test.ts +++ b/extensions/zai/detect.test.ts @@ -124,7 +124,7 @@ describe("detectZaiEndpoint", () => { it("caps oversized probe timeouts before scheduling", async () => { const timeoutSpy = vi .spyOn(globalThis, "setTimeout") - .mockImplementation((() => 1) as typeof setTimeout); + .mockReturnValue(1 as unknown as ReturnType); vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined); const fetchFn = makeFetch({ "https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 200 }, diff --git a/extensions/zalo/src/api.test.ts b/extensions/zalo/src/api.test.ts index 84a72d4fb8b..4e5cad92132 100644 --- a/extensions/zalo/src/api.test.ts +++ b/extensions/zalo/src/api.test.ts @@ -97,7 +97,7 @@ describe("Zalo API request methods", () => { it("caps oversized sendChatAction timeouts before scheduling the timer", async () => { const setTimeoutMock = vi .spyOn(globalThis, "setTimeout") - .mockImplementation((() => 1) as typeof setTimeout); + .mockReturnValue(1 as unknown as ReturnType); const clearTimeoutMock = vi .spyOn(globalThis, "clearTimeout") .mockImplementation(() => undefined);