mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-03 18:04:06 +00:00
test: fix timeout mock return types
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user