test(google): use real responses in Gemini search fixture

This commit is contained in:
Vincent Koc
2026-06-23 12:05:12 +08:00
parent 9d4df88e97
commit f6038b3a33

View File

@@ -10,10 +10,9 @@ type TestModelProviderConfig = NonNullable<
function installGeminiFetch() {
const mockFetch = vi.fn((_input?: RequestInfo | URL, _init?: RequestInit) =>
Promise.resolve({
ok: true,
json: () =>
Promise.resolve({
Promise.resolve(
new Response(
JSON.stringify({
candidates: [
{
content: { parts: [{ text: "Grounded answer" }] },
@@ -23,7 +22,8 @@ function installGeminiFetch() {
},
],
}),
} as Response),
),
),
);
vi.stubGlobal("fetch", withFetchPreconnect(mockFetch));
return mockFetch;