Files
openclaw/src/infra/google-api-base-url.test.ts
2026-03-27 23:33:08 +00:00

34 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { DEFAULT_GOOGLE_API_BASE_URL, normalizeGoogleApiBaseUrl } from "./google-api-base-url.js";
describe("normalizeGoogleApiBaseUrl", () => {
it("defaults to the Gemini v1beta API root", () => {
expect(normalizeGoogleApiBaseUrl()).toBe(DEFAULT_GOOGLE_API_BASE_URL);
});
it.each([
{
value: "https://generativelanguage.googleapis.com",
expected: DEFAULT_GOOGLE_API_BASE_URL,
},
{
value: "https://generativelanguage.googleapis.com/",
expected: DEFAULT_GOOGLE_API_BASE_URL,
},
{
value: "https://generativelanguage.googleapis.com/v1beta",
expected: DEFAULT_GOOGLE_API_BASE_URL,
},
{
value: "https://generativelanguage.googleapis.com/v1",
expected: "https://generativelanguage.googleapis.com/v1",
},
{
value: "https://proxy.example.com/google/v1beta/",
expected: "https://proxy.example.com/google/v1beta",
},
])("normalizes %s", ({ value, expected }) => {
expect(normalizeGoogleApiBaseUrl(value)).toBe(expected);
});
});