mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
fix(ui): pass i18n.t to users columns factory in tests
This commit is contained in:
parent
fa7ee22cba
commit
2d3fcca245
2 changed files with 14 additions and 15 deletions
|
|
@ -67,12 +67,7 @@ export const columns = (
|
|||
(row.original.metadata as Record<string, unknown> | null | undefined)?.scim_active === false;
|
||||
if (isScimInactive) {
|
||||
return (
|
||||
<Tooltip
|
||||
title={tr(
|
||||
"scimInactiveTooltip",
|
||||
"Deactivated via SCIM (external identity provider). The user's virtual keys are blocked.",
|
||||
)}
|
||||
>
|
||||
<Tooltip title={tr("scimInactiveTooltip")}>
|
||||
<Tag color="red" data-testid={`user-status-${row.original.user_id}`}>
|
||||
{tr("inactive")}
|
||||
</Tag>
|
||||
|
|
@ -118,12 +113,7 @@ export const columns = (
|
|||
header: () => (
|
||||
<div className="flex items-center gap-2">
|
||||
<span>{tr("ssoId")}</span>
|
||||
<Tooltip
|
||||
title={tr(
|
||||
"ssoIdTooltip",
|
||||
"SSO ID is the ID of the user in the SSO provider. If the user is not using SSO, this will be null.",
|
||||
)}
|
||||
>
|
||||
<Tooltip title={tr("ssoIdTooltip")}>
|
||||
<InformationCircleIcon className="w-4 h-4" />
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue