Files
OmniRoute/tests/unit/translator-openai-to-gemini-defaults.test.ts
backryun 888c872459 refactor(antigravity): align official clients and callable catalog (#8013)
* fix(antigravity): preserve protocol fidelity and fail closed

* chore: add PR-numbered changelog fragment

* test: split oversized Antigravity suites

* refactor(antigravity): align official IDE and CLI identities

* fix(antigravity): align catalog with callable models

* test(antigravity): update 2 test files to renamed version-cache API (#8013 fix)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: nguyenha935 <208228297+nguyenha935@users.noreply.github.com>
Co-authored-by: backryun <backryun@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: nguyenha935 <nguyenha935@users.noreply.github.com>
Co-authored-by: Probe Test <probe@example.com>
2026-07-22 20:41:19 -03:00

40 lines
1.6 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
const { openaiToCloudCodeGeminiRequest } =
await import("../../open-sse/translator/request/openai-to-gemini.ts");
test("OpenAI -> Cloud Code Gemini applies native request defaults", () => {
// gemini-3.1-pro is thinking-capable; the previous fixture (gemini-3-flash-preview,
// supportsThinking: false / cap 0) encoded the pre-#6943 bug of requesting thoughts
// from a non-thinking model — reasoning_effort on a capped-at-0 model now correctly
// yields thinkingBudget 0 / includeThoughts false (see the flash assertion below).
const request = openaiToCloudCodeGeminiRequest(
"gemini-3.1-pro",
{
messages: [{ role: "user", content: "Hello" }],
reasoning_effort: "high",
},
true
) as {
model: string;
generationConfig: { thinkingConfig: { includeThoughts: boolean }; topK?: number };
contents: Array<{ parts: Array<{ text: string }> }>;
};
assert.equal(request.model, "gemini-3.1-pro");
assert.equal(request.generationConfig.thinkingConfig.includeThoughts, true);
const flash = openaiToCloudCodeGeminiRequest(
"gemini-3-flash-preview",
{ messages: [{ role: "user", content: "Hello" }], reasoning_effort: "high" },
true
) as {
generationConfig: { thinkingConfig: { thinkingBudget: number; includeThoughts: boolean } };
};
assert.equal(flash.generationConfig.thinkingConfig.thinkingBudget, 0);
assert.equal(flash.generationConfig.thinkingConfig.includeThoughts, false);
assert.equal(request.generationConfig.topK, undefined);
assert.equal(request.contents.at(-1).parts[0].text, "Hello");
});