test: fix timeout mock return types

This commit is contained in:
Peter Steinberger
2026-05-29 16:38:29 -04:00
parent a509c48f0e
commit d10fd6b8f4
4 changed files with 4 additions and 4 deletions

View File

@@ -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<typeof setTimeout>);
vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined);
mockFetch.mockResolvedValueOnce({
ok: true,

View File

@@ -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<typeof setTimeout>);
const clearTimeoutSpy = vi
.spyOn(globalThis, "clearTimeout")
.mockImplementation(() => undefined);

View File

@@ -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<typeof setTimeout>);
vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined);
const fetchFn = makeFetch({
"https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 200 },

View File

@@ -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<typeof setTimeout>);
const clearTimeoutMock = vi
.spyOn(globalThis, "clearTimeout")
.mockImplementation(() => undefined);