test: fix fetch mock typing casts

This commit is contained in:
Agent
2026-03-01 22:44:22 +00:00
parent 002539c01e
commit bc9f357ad7
2 changed files with 10 additions and 4 deletions

View File

@@ -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({

View File

@@ -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();
});