test(agents): share google extra params setup

This commit is contained in:
Vincent Koc
2026-04-12 09:55:02 +01:00
parent bd487d5eb2
commit 4962644149

View File

@@ -21,6 +21,22 @@ afterEach(() => {
extraParamsTesting.resetProviderRuntimeDepsForTest();
});
function runGoogleExtraParamsCase(params?: { cfg?: unknown }) {
return runExtraParamsCase({
...(params?.cfg ? { cfg: params.cfg as never } : {}),
applyProvider: "google",
applyModelId: "gemini-2.5-pro",
model: {
api: "google-generative-ai",
provider: "google",
id: "gemini-2.5-pro",
} as unknown as Model<"openai-completions">,
payload: {
contents: [],
},
});
}
describe("extra-params: Google thinking payload compatibility", () => {
it("strips negative thinking budgets and fills Gemini 3.1 thinkingLevel", () => {
const payload = runExtraParamsCase({
@@ -51,7 +67,7 @@ describe("extra-params: Google thinking payload compatibility", () => {
});
it("passes cachedContent through Google extra params", () => {
const { options } = runExtraParamsCase({
const { options } = runGoogleExtraParamsCase({
cfg: {
agents: {
defaults: {
@@ -64,16 +80,6 @@ describe("extra-params: Google thinking payload compatibility", () => {
},
},
},
} as never,
applyProvider: "google",
applyModelId: "gemini-2.5-pro",
model: {
api: "google-generative-ai",
provider: "google",
id: "gemini-2.5-pro",
} as unknown as Model<"openai-completions">,
payload: {
contents: [],
},
});
@@ -83,7 +89,7 @@ describe("extra-params: Google thinking payload compatibility", () => {
});
it("lets higher-precedence cachedContent override lower-precedence cached_content", () => {
const { options } = runExtraParamsCase({
const { options } = runGoogleExtraParamsCase({
cfg: {
agents: {
defaults: {
@@ -99,16 +105,6 @@ describe("extra-params: Google thinking payload compatibility", () => {
},
},
},
} as never,
applyProvider: "google",
applyModelId: "gemini-2.5-pro",
model: {
api: "google-generative-ai",
provider: "google",
id: "gemini-2.5-pro",
} as unknown as Model<"openai-completions">,
payload: {
contents: [],
},
});