test: dedupe ollama embedding fetch mock read

This commit is contained in:
Peter Steinberger
2026-05-13 07:18:13 +01:00
parent 4cf6971130
commit 63ee74109e

View File

@@ -47,11 +47,11 @@ function mockEmbeddingFetch(embedding: number[]) {
}
function firstFetchInit(fetchMock: ReturnType<typeof mockEmbeddingFetch>): RequestInit | undefined {
const call = fetchMock.mock.calls.at(0);
const call = fetchMock.mock.calls[0] as unknown[] | undefined;
if (!call) {
throw new Error("expected embedding fetch call");
}
return call.at(1) as RequestInit | undefined;
return call[1] as RequestInit | undefined;
}
function readEmbeddingRequestBody(init: RequestInit | undefined): { input?: unknown } {