From 2d3fcca2453b7f31c929469c01bd25faca95ab77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B9=E9=9B=AA?= <2b@yorha.xyz> Date: Thu, 11 Jun 2026 06:25:48 +0900 Subject: [PATCH] fix(ui): pass i18n.t to users columns factory in tests --- .../src/components/view_users/columns.tsx | 14 ++------------ .../src/components/view_users/table.test.tsx | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_users/columns.tsx b/ui/litellm-dashboard/src/components/view_users/columns.tsx index 0d4283bc8a2..be02a0bcf9f 100644 --- a/ui/litellm-dashboard/src/components/view_users/columns.tsx +++ b/ui/litellm-dashboard/src/components/view_users/columns.tsx @@ -67,12 +67,7 @@ export const columns = ( (row.original.metadata as Record | null | undefined)?.scim_active === false; if (isScimInactive) { return ( - + {tr("inactive")} @@ -118,12 +113,7 @@ export const columns = ( header: () => (
{tr("ssoId")} - +
diff --git a/ui/litellm-dashboard/src/components/view_users/table.test.tsx b/ui/litellm-dashboard/src/components/view_users/table.test.tsx index b679014e9aa..57bc3c305ad 100644 --- a/ui/litellm-dashboard/src/components/view_users/table.test.tsx +++ b/ui/litellm-dashboard/src/components/view_users/table.test.tsx @@ -1,4 +1,5 @@ import { act, fireEvent, render, screen } from "@testing-library/react"; +import i18n from "@/lib/i18n"; import { describe, expect, it, vi } from "vitest"; import { columns } from "./columns"; import { UserDataTable } from "./table"; @@ -120,7 +121,15 @@ describe("UserDataTable", () => { it("should render the user-row Status cell as Active when scim_active is not set to false", () => { const possibleUIRoles = { admin: { ui_label: "Admin" } }; const handlers = { edit: vi.fn(), del: vi.fn(), reset: vi.fn(), click: vi.fn() }; - const cols = columns(possibleUIRoles, handlers.edit, handlers.del, handlers.reset, handlers.click); + const cols = columns( + possibleUIRoles, + handlers.edit, + handlers.del, + handlers.reset, + handlers.click, + undefined, + i18n.t, + ); const statusCol = cols.find((c) => (c as { id?: string }).id === "status"); expect(statusCol).toBeDefined(); @@ -147,7 +156,7 @@ describe("UserDataTable", () => { it("should render the user-row Status cell as Inactive when scim_active is false", () => { const possibleUIRoles = { admin: { ui_label: "Admin" } }; - const cols = columns(possibleUIRoles, vi.fn(), vi.fn(), vi.fn(), vi.fn()); + const cols = columns(possibleUIRoles, vi.fn(), vi.fn(), vi.fn(), vi.fn(), undefined, i18n.t); const statusCol = cols.find((c) => (c as { id?: string }).id === "status")!; const inactiveUser: UserInfo = { @@ -174,7 +183,7 @@ describe("UserDataTable", () => { it("should treat scim_active=true as Active (not Inactive)", () => { const possibleUIRoles = { admin: { ui_label: "Admin" } }; - const cols = columns(possibleUIRoles, vi.fn(), vi.fn(), vi.fn(), vi.fn()); + const cols = columns(possibleUIRoles, vi.fn(), vi.fn(), vi.fn(), vi.fn(), undefined, i18n.t); const statusCol = cols.find((c) => (c as { id?: string }).id === "status")!; const reactivated: UserInfo = {