perf(test): trim retry-loop work in embedding batch tests

This commit is contained in:
Peter Steinberger
2026-02-13 22:42:03 +00:00
parent e324cb5b94
commit faeac955b5

View File

@@ -169,7 +169,7 @@ describe("memory embedding batches", () => {
let calls = 0;
embedBatch.mockImplementation(async (texts: string[]) => {
calls += 1;
if (calls < 3) {
if (calls < 2) {
throw new Error("openai embeddings failed: 429 rate limit");
}
return texts.map(() => [0, 1, 0]);
@@ -217,7 +217,7 @@ describe("memory embedding batches", () => {
setTimeoutSpy.mockRestore();
}
expect(calls).toBe(3);
expect(calls).toBe(2);
}, 10000);
it("retries embeddings on transient 5xx errors", async () => {
@@ -228,7 +228,7 @@ describe("memory embedding batches", () => {
let calls = 0;
embedBatch.mockImplementation(async (texts: string[]) => {
calls += 1;
if (calls < 3) {
if (calls < 2) {
throw new Error("openai embeddings failed: 502 Bad Gateway (cloudflare)");
}
return texts.map(() => [0, 1, 0]);
@@ -276,7 +276,7 @@ describe("memory embedding batches", () => {
setTimeoutSpy.mockRestore();
}
expect(calls).toBe(3);
expect(calls).toBe(2);
}, 10000);
it("skips empty chunks so embeddings input stays valid", async () => {