mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-07 15:52:52 +03:00
test(antigravity): assert converted chat.completion for non-stream 429 retry
The executor's non-streaming path collects the upstream SSE and returns a finished OpenAI chat.completion payload. The test still treated the body as raw SSE and piped it through parseSSEToGeminiResponse, which correctly returns null for non-SSE input — failing the release-tip unit suite. Verified the production output is exactly what the test's own assertions expect (content 'Hello again', usage 2/3/5, finish_reason stop, 2 fetch calls incl. the 429 retry), so this realigns the test with the real contract rather than weakening it: 3 pass/1 fail -> 4 pass/0 fail.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- Realign the Antigravity non-streaming 429-retry test with the executor's actual contract: it returns the already-converted OpenAI `chat.completion` payload, so the test asserts that payload directly instead of re-parsing it as raw SSE (which returned `null` and failed the release-tip unit suite).
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
AntigravityExecutor,
|
||||
createCreditsExtractionTransform,
|
||||
} from "../../open-sse/executors/antigravity.ts";
|
||||
import { parseSSEToGeminiResponse } from "../../open-sse/handlers/sseParser/geminiResponse.ts";
|
||||
import {
|
||||
clearAntigravityVersionCache,
|
||||
seedAntigravityVersionCache,
|
||||
@@ -73,11 +72,10 @@ test("AntigravityExecutor.execute auto-retries short 429 responses and collects
|
||||
credentials: { accessToken: "token", projectId: "project-1" },
|
||||
log: { debug() {}, warn() {} },
|
||||
});
|
||||
// Non-streaming now returns raw SSE; parse it the way chatCore would.
|
||||
const rawSSE = await result.response.text();
|
||||
const parsed = parseSSEToGeminiResponse(rawSSE, "antigravity/gemini-2.5-flash");
|
||||
assert.ok(parsed, "parseSSEToGeminiResponse should parse the SSE");
|
||||
const payload = parsed as ChatCompletionPayload;
|
||||
// Non-streaming collects the upstream SSE and returns the already-converted
|
||||
// OpenAI chat.completion payload — no further SSE parsing on the caller side.
|
||||
const payload = JSON.parse(await result.response.text()) as ChatCompletionPayload;
|
||||
assert.equal(payload.object, "chat.completion");
|
||||
|
||||
assert.equal(calls.length, 2);
|
||||
assert.equal(result.response.status, 200);
|
||||
|
||||
Reference in New Issue
Block a user