From 7e3b2ff7afe052097c4414fc64d7e66191e8fcc3 Mon Sep 17 00:00:00 2001 From: Sebastian <19554889+sebslight@users.noreply.github.com> Date: Tue, 17 Feb 2026 09:41:38 -0500 Subject: [PATCH] test(fetch): fix mock typing openclaw#19194 thanks @sebslight --- src/agents/chutes-oauth.e2e.test.ts | 4 ++-- src/commands/chutes-oauth.e2e.test.ts | 2 +- src/memory/embeddings-voyage.test.ts | 14 -------------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/agents/chutes-oauth.e2e.test.ts b/src/agents/chutes-oauth.e2e.test.ts index dd960b4998..a4292b3eb2 100644 --- a/src/agents/chutes-oauth.e2e.test.ts +++ b/src/agents/chutes-oauth.e2e.test.ts @@ -16,7 +16,7 @@ const urlToString = (url: Request | URL | string): string => { describe("chutes-oauth", () => { it("exchanges code for tokens and stores username as email", async () => { - const fetchFn = withFetchPreconnect(async (input, init) => { + const fetchFn = withFetchPreconnect(async (input: RequestInfo | URL, init?: RequestInit) => { const url = urlToString(input); if (url === CHUTES_TOKEN_ENDPOINT) { expect(init?.method).toBe("POST"); @@ -66,7 +66,7 @@ describe("chutes-oauth", () => { }); it("refreshes tokens using stored client id and falls back to old refresh token", async () => { - const fetchFn = withFetchPreconnect(async (input, init) => { + const fetchFn = withFetchPreconnect(async (input: RequestInfo | URL, init?: RequestInit) => { const url = urlToString(input); if (url !== CHUTES_TOKEN_ENDPOINT) { return new Response("not found", { status: 404 }); diff --git a/src/commands/chutes-oauth.e2e.test.ts b/src/commands/chutes-oauth.e2e.test.ts index afe533ca22..bb30707a80 100644 --- a/src/commands/chutes-oauth.e2e.test.ts +++ b/src/commands/chutes-oauth.e2e.test.ts @@ -33,7 +33,7 @@ function createOAuthFetchFn(params: { username: string; passthrough?: boolean; }) { - return withFetchPreconnect(async (input, init) => { + return withFetchPreconnect(async (input: RequestInfo | URL, init?: RequestInit) => { const url = urlToString(input); if (url === CHUTES_TOKEN_ENDPOINT) { return new Response( diff --git a/src/memory/embeddings-voyage.test.ts b/src/memory/embeddings-voyage.test.ts index cdde6ace88..822eabd55a 100644 --- a/src/memory/embeddings-voyage.test.ts +++ b/src/memory/embeddings-voyage.test.ts @@ -96,19 +96,6 @@ describe("voyage embedding provider", () => { it("passes input_type=document for embedBatch", async () => { const fetchMock = withFetchPreconnect( -<<<<<<< HEAD - vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) => { - return new Response( - JSON.stringify({ - data: [{ embedding: [0.1, 0.2] }, { embedding: [0.3, 0.4] }], - }), - { - status: 200, - headers: { "Content-Type": "application/json" }, - }, - ); - }), -======= vi.fn( async (_input: RequestInfo | URL, _init?: RequestInit) => new Response( @@ -118,7 +105,6 @@ describe("voyage embedding provider", () => { { status: 200, headers: { "Content-Type": "application/json" } }, ), ), ->>>>>>> 03a725142 (test(fetch): align mocks openclaw#19194 thanks @sebslight) ); vi.stubGlobal("fetch", fetchMock);