From bc9f357ad7978686cba39a294eac84536d1858d3 Mon Sep 17 00:00:00 2001 From: Agent Date: Sun, 1 Mar 2026 22:44:22 +0000 Subject: [PATCH] test: fix fetch mock typing casts --- ...odels-config.providers.ollama-autodiscovery.test.ts | 10 +++++++--- src/slack/send.upload.test.ts | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/agents/models-config.providers.ollama-autodiscovery.test.ts b/src/agents/models-config.providers.ollama-autodiscovery.test.ts index c20bf4051ea..910f0e056e6 100644 --- a/src/agents/models-config.providers.ollama-autodiscovery.test.ts +++ b/src/agents/models-config.providers.ollama-autodiscovery.test.ts @@ -44,7 +44,7 @@ describe("Ollama auto-discovery", () => { }; } throw new Error(`Unexpected fetch: ${url}`); - }) as typeof fetch; + }) as unknown as typeof fetch; const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-")); const providers = await resolveImplicitProviders({ agentDir }); @@ -64,7 +64,9 @@ describe("Ollama auto-discovery", () => { const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); globalThis.fetch = vi .fn() - .mockRejectedValue(new Error("connect ECONNREFUSED 127.0.0.1:11434")) as typeof fetch; + .mockRejectedValue( + new Error("connect ECONNREFUSED 127.0.0.1:11434"), + ) as unknown as typeof fetch; const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-")); const providers = await resolveImplicitProviders({ agentDir }); @@ -82,7 +84,9 @@ describe("Ollama auto-discovery", () => { const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); globalThis.fetch = vi .fn() - .mockRejectedValue(new Error("connect ECONNREFUSED 127.0.0.1:11434")) as typeof fetch; + .mockRejectedValue( + new Error("connect ECONNREFUSED 127.0.0.1:11434"), + ) as unknown as typeof fetch; const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-")); await resolveImplicitProviders({ diff --git a/src/slack/send.upload.test.ts b/src/slack/send.upload.test.ts index c1adf325237..4b8b3d431cf 100644 --- a/src/slack/send.upload.test.ts +++ b/src/slack/send.upload.test.ts @@ -61,7 +61,9 @@ describe("sendMessageSlack file upload with user IDs", () => { const originalFetch = globalThis.fetch; beforeEach(() => { - globalThis.fetch = vi.fn(async () => new Response("ok", { status: 200 })) as typeof fetch; + globalThis.fetch = vi.fn( + async () => new Response("ok", { status: 200 }), + ) as unknown as typeof fetch; fetchWithSsrFGuard.mockClear(); });