test: fix timeout mock return types · openclaw/openclaw@d10fd6b
steipete
·
2026-05-30
·
via Recent Commits to openclaw:main
File tree
mattermost/src/mattermost
| Original file line number | Diff line number | Diff line change |
|---|
@@ -355,7 +355,7 @@ describe("createMattermostDirectChannelWithRetry", () => {
|
355 | 355 | it("caps oversized request timeouts before scheduling aborts", async () => { |
356 | 356 | const timeoutSpy = vi |
357 | 357 | .spyOn(globalThis, "setTimeout") |
358 | | -.mockImplementation((() => 1) as typeof setTimeout); |
| 358 | +.mockReturnValue(1 as unknown as ReturnType<typeof setTimeout>); |
359 | 359 | vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined); |
360 | 360 | mockFetch.mockResolvedValueOnce({ |
361 | 361 | ok: true, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -214,7 +214,7 @@ describe("buildXiaomiSpeechProvider", () => {
|
214 | 214 | const audio = Buffer.from("fake-mp3-audio").toString("base64"); |
215 | 215 | const timeoutSpy = vi |
216 | 216 | .spyOn(globalThis, "setTimeout") |
217 | | -.mockImplementation((() => 1) as typeof setTimeout); |
| 217 | +.mockReturnValue(1 as unknown as ReturnType<typeof setTimeout>); |
218 | 218 | const clearTimeoutSpy = vi |
219 | 219 | .spyOn(globalThis, "clearTimeout") |
220 | 220 | .mockImplementation(() => undefined); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -124,7 +124,7 @@ describe("detectZaiEndpoint", () => {
|
124 | 124 | it("caps oversized probe timeouts before scheduling", async () => { |
125 | 125 | const timeoutSpy = vi |
126 | 126 | .spyOn(globalThis, "setTimeout") |
127 | | -.mockImplementation((() => 1) as typeof setTimeout); |
| 127 | +.mockReturnValue(1 as unknown as ReturnType<typeof setTimeout>); |
128 | 128 | vi.spyOn(globalThis, "clearTimeout").mockImplementation(() => undefined); |
129 | 129 | const fetchFn = makeFetch({ |
130 | 130 | "https://api.z.ai/api/paas/v4/chat/completions::glm-5.1": { status: 200 }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -97,7 +97,7 @@ describe("Zalo API request methods", () => {
|
97 | 97 | it("caps oversized sendChatAction timeouts before scheduling the timer", async () => { |
98 | 98 | const setTimeoutMock = vi |
99 | 99 | .spyOn(globalThis, "setTimeout") |
100 | | -.mockImplementation((() => 1) as typeof setTimeout); |
| 100 | +.mockReturnValue(1 as unknown as ReturnType<typeof setTimeout>); |
101 | 101 | const clearTimeoutMock = vi |
102 | 102 | .spyOn(globalThis, "clearTimeout") |
103 | 103 | .mockImplementation(() => undefined); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。