The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui): read the preset catalog through the shared mock in the lib test
mateo-berrif62e87d28c0b
diff --git a/ui/litellm-dashboard/src/lib/autorouter_presets.test.ts b/ui/litellm-dashboard/src/lib/autorouter_presets.test.tsindex 44ac6973a1c..76996447ac8 100644--- a/ui/litellm-dashboard/src/lib/autorouter_presets.test.ts+++ b/ui/litellm-dashboard/src/lib/autorouter_presets.test.ts@@ -1,9 +1,8 @@import { describe, it, expect } from "vitest";-import bundledPresets from "../../../../litellm/proxy/public_endpoints/autorouter_presets.json";+import { BUNDLED_PRESETS_RESPONSE } from "../../tests/mocks/autoRouterPresets";import {hydratePresets,AutoRouterPreset,- AutoRouterPresetsResponse,getRequiredModelsInPreset,getMissingModelsInPreset,getRequiredModels,@@ -21,7 +20,7 @@ import { DEFAULT_ESCALATION_KEYWORDS } from "@/components/add_model/EscalationKeconst groupsOnly = (models: Iterable<string>) => buildModelAvailability(models, []);// Hydrated from the real bundled catalog so a catalog edit flows into these expectations.-const PRESETS = hydratePresets(bundledPresets as AutoRouterPresetsResponse);+const PRESETS = hydratePresets(BUNDLED_PRESETS_RESPONSE);const getAllPresets = (): AutoRouterPreset[] => PRESETS;const getPresetByKey = (key: string): AutoRouterPreset | undefined => PRESETS.find((p) => p.key === key);diff --git a/ui/litellm-dashboard/tests/mocks/autoRouterPresets.ts b/ui/litellm-dashboard/tests/mocks/autoRouterPresets.tsindex cff417e6bfa..ac6da9bceba 100644--- a/ui/litellm-dashboard/tests/mocks/autoRouterPresets.ts+++ b/ui/litellm-dashboard/tests/mocks/autoRouterPresets.ts@@ -7,9 +7,9 @@ import { hydratePresets, type AutoRouterPresetsResponse } from "@/lib/autorouter// instead of redding on a stale copy. Exported as vi.fn so a test can override the query state.const CATALOG_PATH = resolve(__dirname, "../../../../litellm/proxy/public_endpoints/autorouter_presets.json");-export const BUNDLED_PRESETS = hydratePresets(- JSON.parse(readFileSync(CATALOG_PATH, "utf8")) as AutoRouterPresetsResponse,-);+export const BUNDLED_PRESETS_RESPONSE = JSON.parse(readFileSync(CATALOG_PATH, "utf8")) as AutoRouterPresetsResponse;++export const BUNDLED_PRESETS = hydratePresets(BUNDLED_PRESETS_RESPONSE);export const LOADED_PRESETS_QUERY = {data: BUNDLED_PRESETS,