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
test(ui): make the TokenFlow grouping assertion locale-independent
Yuneng Jiangc25f927f0348
diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TokenFlow.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TokenFlow.test.tsxindex f1784bb4009..0e76b92da36 100644--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TokenFlow.test.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/TokenFlow.test.tsx@@ -2,6 +2,8 @@ import { render, screen } from "@testing-library/react";import { describe, expect, it } from "vitest";import { TokenFlow } from "./TokenFlow";+const localised = (count: number) => count.toLocaleString();+describe("TokenFlow", () => {it("should render the total followed by its prompt and completion breakdown", () => {render(<TokenFlow prompt={9} completion={3} total={12} />);@@ -9,10 +11,14 @@ describe("TokenFlow", () => {expect(screen.getByText("12 (9 prompt tokens + 3 completion tokens)")).toBeInTheDocument();});- it("should group large counts with thousands separators", () => {+ it("should group large counts the way the reader's locale does", () => {render(<TokenFlow prompt={1234567} completion={89012} total={1323579} />);- expect(screen.getByText("1,323,579 (1,234,567 prompt tokens + 89,012 completion tokens)")).toBeInTheDocument();+ expect(+ screen.getByText(+ `${localised(1323579)} (${localised(1234567)} prompt tokens + ${localised(89012)} completion tokens)`,+ ),+ ).toBeInTheDocument();});it("should fall back to zero for counts the log entry does not carry", () => {