perf: avoid heavy imports in hot tests

This commit is contained in:
Peter Steinberger
2026-04-27 23:56:56 +01:00
parent 39a2d1da96
commit c27b82d431
2 changed files with 3 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { resolveAuthProfileOrder } from "./auth-profiles/order.js";
import type { AuthProfileStore } from "./auth-profiles/types.js";
import { isProfileInCooldown } from "./auth-profiles/usage.js";
import { isProfileInCooldown } from "./auth-profiles/usage-state.js";
/**
* Integration tests for cooldown auto-expiry through resolveAuthProfileOrder.

View File

@@ -1,6 +1,5 @@
import { resolveProviderEndpoint } from "../agents/provider-attribution.js";
export const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
const GOOGLE_GENERATIVE_LANGUAGE_HOST = "generativelanguage.googleapis.com";
function trimTrailingSlashes(value: string): string {
return value.replace(/\/+$/, "");
@@ -17,7 +16,7 @@ export function normalizeGoogleApiBaseUrl(baseUrl?: string): string {
url.hash = "";
url.search = "";
if (
resolveProviderEndpoint(url.toString()).endpointClass === "google-generative-ai" &&
url.hostname.toLowerCase() === GOOGLE_GENERATIVE_LANGUAGE_HOST &&
trimTrailingSlashes(url.pathname || "") === ""
) {
url.pathname = "/v1beta";