diff --git a/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsx b/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsx
index 3052f790098..6da2f82a2f1 100644
--- a/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsx
+++ b/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.test.tsx
@@ -37,12 +37,19 @@ vi.mock("antd", async (importOriginal) => {
mode,
...props
}: any) => {
+ // Simulate maxTagCount responsive behavior - if value length > 5, call maxTagPlaceholder
+ const shouldShowPlaceholder = maxTagCount === "responsive" && Array.isArray(value) && value.length > 5;
+ const visibleValues = shouldShowPlaceholder ? value.slice(0, 5) : value;
+ const omittedValues = shouldShowPlaceholder
+ ? value.slice(5).map((v: string) => ({ value: v, label: v }))
+ : [];
+
return (
+ {shouldShowPlaceholder && maxTagPlaceholder && (
+
{maxTagPlaceholder(omittedValues)}
+ )}
);
},
@@ -82,6 +92,24 @@ const mockUseTeam = vi.mocked(useTeam);
const mockUseOrganization = vi.mocked(useOrganization);
const mockUseCurrentUser = vi.mocked(useCurrentUser);
+const createMockOrganization = (models: string[]): Organization => ({
+ organization_id: "org-1",
+ organization_alias: "Test Org",
+ budget_id: "budget-1",
+ metadata: {},
+ models,
+ spend: 0,
+ model_spend: {},
+ created_at: "2024-01-01",
+ created_by: "user-1",
+ updated_at: "2024-01-01",
+ updated_by: "user-1",
+ litellm_budget_table: null,
+ teams: null,
+ users: null,
+ members: null,
+});
+
describe("ModelSelect", () => {
const mockProxyModels: ProxyModel[] = [
{ id: "gpt-4", object: "model", created: 1234567890, owned_by: "openai" },
@@ -112,125 +140,44 @@ describe("ModelSelect", () => {
} as any);
});
- it("should render", async () => {
+ it("should render with all option groups", async () => {
renderWithProviders(
,
);
await waitFor(() => {
expect(screen.getByTestId("model-select")).toBeInTheDocument();
- });
- });
-
- it("should show skeleton loader when loading", () => {
- mockUseAllProxyModels.mockReturnValue({
- data: undefined,
- isLoading: true,
- } as any);
-
- renderWithProviders();
-
- expect(screen.getByTestId("skeleton-input")).toBeInTheDocument();
- expect(screen.queryByTestId("model-select")).not.toBeInTheDocument();
- });
-
- it("should show skeleton loader when team is loading", () => {
- mockUseTeam.mockReturnValue({
- data: undefined,
- isLoading: true,
- } as any);
-
- renderWithProviders();
-
- expect(screen.getByTestId("skeleton-input")).toBeInTheDocument();
- });
-
- it("should show skeleton loader when organization is loading", () => {
- mockUseOrganization.mockReturnValue({
- data: undefined,
- isLoading: true,
- } as any);
-
- renderWithProviders();
-
- expect(screen.getByTestId("skeleton-input")).toBeInTheDocument();
- });
-
- it("should show skeleton loader when current user is loading", () => {
- mockUseCurrentUser.mockReturnValue({
- data: undefined,
- isLoading: true,
- } as any);
-
- renderWithProviders();
-
- expect(screen.getByTestId("skeleton-input")).toBeInTheDocument();
- });
-
- it("should render special options group", async () => {
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["all-proxy-models"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
-
- mockUseOrganization.mockReturnValue({
- data: mockOrganization,
- isLoading: false,
- } as any);
-
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
- const select = screen.getByTestId("model-select");
- expect(select).toBeInTheDocument();
- expect(screen.getByText("All Proxy Models")).toBeInTheDocument();
- expect(screen.getByText("No Default Models")).toBeInTheDocument();
- });
- });
-
- it("should render wildcard options group", async () => {
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
+ expect(screen.getByText("gpt-4")).toBeInTheDocument();
+ expect(screen.getByText("claude-3")).toBeInTheDocument();
expect(screen.getByText("All Openai models")).toBeInTheDocument();
expect(screen.getByText("All Anthropic models")).toBeInTheDocument();
});
});
- it("should render regular models group", async () => {
- renderWithProviders(
- ,
- );
+ it("should show skeleton loader when any data is loading", () => {
+ const loadingScenarios = [
+ { hook: mockUseAllProxyModels, context: "user" as const },
+ { hook: mockUseTeam, context: "team" as const, props: { teamID: "team-1" } },
+ { hook: mockUseOrganization, context: "organization" as const, props: { organizationID: "org-1" } },
+ { hook: mockUseCurrentUser, context: "user" as const },
+ ];
- await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.getByText("claude-3")).toBeInTheDocument();
+ loadingScenarios.forEach(({ hook, context, props = {} }) => {
+ hook.mockReturnValue({
+ data: undefined,
+ isLoading: true,
+ } as any);
+
+ const { unmount } = renderWithProviders(
+ ,
+ );
+
+ expect(screen.getByTestId("skeleton-input")).toBeInTheDocument();
+ unmount();
});
});
- it("should call onChange when selecting a regular model", async () => {
+ it("should handle model selection and onChange", async () => {
const user = userEvent.setup();
renderWithProviders(
,
@@ -242,32 +189,16 @@ describe("ModelSelect", () => {
const select = screen.getByRole("listbox");
await user.selectOptions(select, "gpt-4");
-
expect(mockOnChange).toHaveBeenCalledWith(["gpt-4"]);
+
+ await user.selectOptions(select, ["gpt-4", "claude-3"]);
+ expect(mockOnChange).toHaveBeenCalled();
});
- it("should call onChange with only last special option when multiple special options are selected", async () => {
+ it("should handle special options correctly", async () => {
const user = userEvent.setup();
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["all-proxy-models"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
-
mockUseOrganization.mockReturnValue({
- data: mockOrganization,
+ data: createMockOrganization(["all-proxy-models"]),
isLoading: false,
} as any);
@@ -281,16 +212,16 @@ describe("ModelSelect", () => {
);
await waitFor(() => {
- expect(screen.getByTestId("model-select")).toBeInTheDocument();
+ expect(screen.getByText("All Proxy Models")).toBeInTheDocument();
+ expect(screen.getByText("No Default Models")).toBeInTheDocument();
});
const select = screen.getByRole("listbox");
await user.selectOptions(select, ["all-proxy-models", "no-default-models"]);
-
expect(mockOnChange).toHaveBeenCalledWith(["no-default-models"]);
});
- it("should disable regular models when special option is selected", async () => {
+ it("should disable models when special option is selected", async () => {
renderWithProviders(
{
);
await waitFor(() => {
- const gpt4Option = screen.getByRole("option", { name: "gpt-4" });
- expect(gpt4Option).toBeDisabled();
+ expect(screen.getByRole("option", { name: "gpt-4" })).toBeDisabled();
+ expect(screen.getByRole("option", { name: "All Openai models" })).toBeDisabled();
});
});
- it("should disable wildcard models when special option is selected", async () => {
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
- const openaiWildcardOption = screen.getByRole("option", { name: "All Openai models" });
- expect(openaiWildcardOption).toBeDisabled();
- });
- });
-
- it("should disable other special options when one special option is selected", async () => {
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["all-proxy-models"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
-
- mockUseOrganization.mockReturnValue({
- data: mockOrganization,
- isLoading: false,
- } as any);
-
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
- const noDefaultOption = screen.getByRole("option", { name: "No Default Models" });
- expect(noDefaultOption).toBeDisabled();
- });
- });
+ it("should filter models based on context", async () => {
+ const testCases = [
+ {
+ name: "user context with includeUserModels",
+ context: "user" as const,
+ options: { includeUserModels: true },
+ setup: () => {
+ mockUseCurrentUser.mockReturnValue({
+ data: { models: ["gpt-4"] },
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: ["gpt-4"],
+ expectedHidden: ["claude-3"],
+ },
+ {
+ name: "user context without includeUserModels",
+ context: "user" as const,
+ options: {},
+ setup: () => {
+ mockUseCurrentUser.mockReturnValue({
+ data: { models: ["gpt-4"] },
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: [],
+ expectedHidden: ["gpt-4", "claude-3"],
+ },
+ {
+ name: "team context without organization",
+ context: "team" as const,
+ options: {},
+ props: { teamID: "team-1" },
+ setup: () => {
+ mockUseTeam.mockReturnValue({
+ data: { team_id: "team-1", team_alias: "Test Team", models: [] },
+ isLoading: false,
+ } as any);
+ mockUseOrganization.mockReturnValue({
+ data: undefined,
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: ["gpt-4", "claude-3"],
+ expectedHidden: [],
+ },
+ {
+ name: "team context with organization having all-proxy-models",
+ context: "team" as const,
+ options: {},
+ props: { teamID: "team-1", organizationID: "org-1" },
+ setup: () => {
+ mockUseTeam.mockReturnValue({
+ data: { team_id: "team-1", team_alias: "Test Team", models: [] },
+ isLoading: false,
+ } as any);
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["all-proxy-models"]),
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: ["gpt-4", "claude-3"],
+ expectedHidden: [],
+ },
+ {
+ name: "team context with organization filtering models",
+ context: "team" as const,
+ options: {},
+ props: { teamID: "team-1", organizationID: "org-1" },
+ setup: () => {
+ mockUseTeam.mockReturnValue({
+ data: { team_id: "team-1", team_alias: "Test Team", models: [] },
+ isLoading: false,
+ } as any);
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["gpt-4"]),
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: ["gpt-4"],
+ expectedHidden: ["claude-3"],
+ },
+ {
+ name: "organization context",
+ context: "organization" as const,
+ options: {},
+ props: { organizationID: "org-1" },
+ setup: () => {
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["gpt-4"]),
+ isLoading: false,
+ } as any);
+ },
+ expectedVisible: ["gpt-4", "claude-3"],
+ expectedHidden: [],
+ },
+ {
+ name: "global context",
+ context: "global" as const,
+ options: {},
+ setup: () => { },
+ expectedVisible: ["gpt-4", "claude-3"],
+ expectedHidden: [],
+ },
+ ];
- it("should filter models when showAllProxyModelsOverride is true", async () => {
- renderWithProviders(
- ,
- );
+ for (const testCase of testCases) {
+ testCase.setup();
+ const { unmount } = renderWithProviders(
+ ,
+ );
- await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.getByText("claude-3")).toBeInTheDocument();
- });
+ await waitFor(() => {
+ testCase.expectedVisible.forEach((model) => {
+ expect(screen.getByText(model)).toBeInTheDocument();
+ });
+ testCase.expectedHidden.forEach((model) => {
+ expect(screen.queryByText(model)).not.toBeInTheDocument();
+ });
+ });
+
+ unmount();
+ vi.clearAllMocks();
+ mockUseAllProxyModels.mockReturnValue({
+ data: { data: mockProxyModels },
+ isLoading: false,
+ } as any);
+ }
});
- it("should filter models when organization has all-proxy-models in models array", async () => {
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["all-proxy-models"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
-
- mockUseOrganization.mockReturnValue({
- data: mockOrganization,
- isLoading: false,
- } as any);
+ it("should show All Proxy Models option based on conditions", async () => {
+ const testCases = [
+ {
+ name: "when showAllProxyModelsOverride is true",
+ context: "user" as const,
+ options: { showAllProxyModelsOverride: true, includeSpecialOptions: true },
+ setup: () => { },
+ shouldShow: true,
+ },
+ {
+ name: "when organization has all-proxy-models",
+ context: "organization" as const,
+ options: { includeSpecialOptions: true },
+ props: { organizationID: "org-1" },
+ setup: () => {
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["all-proxy-models"]),
+ isLoading: false,
+ } as any);
+ },
+ shouldShow: true,
+ },
+ {
+ name: "when organization has empty models array",
+ context: "organization" as const,
+ options: { includeSpecialOptions: true },
+ props: { organizationID: "org-1" },
+ setup: () => {
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization([]),
+ isLoading: false,
+ } as any);
+ },
+ shouldShow: true,
+ },
+ {
+ name: "when context is global",
+ context: "global" as const,
+ options: { includeSpecialOptions: true },
+ setup: () => { },
+ shouldShow: true,
+ },
+ {
+ name: "when organization has specific models",
+ context: "organization" as const,
+ options: { includeSpecialOptions: true },
+ props: { organizationID: "org-1" },
+ setup: () => {
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["gpt-4"]),
+ isLoading: false,
+ } as any);
+ },
+ shouldShow: false,
+ },
+ ];
- renderWithProviders();
+ for (const testCase of testCases) {
+ testCase.setup();
+ const { unmount } = renderWithProviders(
+ ,
+ );
- await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.getByText("claude-3")).toBeInTheDocument();
- });
+ await waitFor(() => {
+ if (testCase.shouldShow) {
+ expect(screen.getByText("All Proxy Models")).toBeInTheDocument();
+ } else {
+ expect(screen.queryByText("All Proxy Models")).not.toBeInTheDocument();
+ expect(screen.getByText("No Default Models")).toBeInTheDocument();
+ }
+ });
+
+ unmount();
+ vi.clearAllMocks();
+ mockUseAllProxyModels.mockReturnValue({
+ data: { data: mockProxyModels },
+ isLoading: false,
+ } as any);
+ }
});
- it("should show all models when organization context is used", async () => {
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["gpt-4"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
+ it("should deduplicate models with same id", async () => {
+ const duplicateModels: ProxyModel[] = [
+ { id: "gpt-4", object: "model", created: 1234567890, owned_by: "openai" },
+ { id: "gpt-4", object: "model", created: 1234567890, owned_by: "openai" },
+ ];
- mockUseOrganization.mockReturnValue({
- data: mockOrganization,
+ mockUseAllProxyModels.mockReturnValue({
+ data: { data: duplicateModels },
isLoading: false,
} as any);
- renderWithProviders();
+ renderWithProviders(
+ ,
+ );
await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.getByText("claude-3")).toBeInTheDocument();
+ const gpt4Options = screen.getAllByText("gpt-4");
+ expect(gpt4Options.length).toBeGreaterThan(0);
});
});
@@ -452,113 +494,77 @@ describe("ModelSelect", () => {
});
});
- it("should handle multiple model selections", async () => {
- const user = userEvent.setup();
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
- expect(screen.getByTestId("model-select")).toBeInTheDocument();
- });
-
- const select = screen.getByRole("listbox");
- await user.selectOptions(select, "gpt-4");
- expect(mockOnChange).toHaveBeenCalledWith(["gpt-4"]);
-
- await user.selectOptions(select, "claude-3");
- expect(mockOnChange).toHaveBeenCalled();
- const allCalls = mockOnChange.mock.calls.map((call) => call[0]);
- expect(allCalls.some((call) => Array.isArray(call) && call.includes("gpt-4"))).toBe(true);
- expect(allCalls.some((call) => Array.isArray(call) && call.includes("claude-3"))).toBe(true);
- });
-
- it("should capitalize provider name in wildcard options", async () => {
- renderWithProviders(
- ,
- );
-
- await waitFor(() => {
- expect(screen.getByText("All Openai models")).toBeInTheDocument();
- expect(screen.getByText("All Anthropic models")).toBeInTheDocument();
- });
- });
-
- it("should deduplicate models with same id", async () => {
- const duplicateModels: ProxyModel[] = [
- { id: "gpt-4", object: "model", created: 1234567890, owned_by: "openai" },
- { id: "gpt-4", object: "model", created: 1234567890, owned_by: "openai" },
- ];
+ it("should return all proxy models for team context when organization has empty models array", async () => {
+ mockUseTeam.mockReturnValue({
+ data: { team_id: "team-1", team_alias: "Test Team", models: [] },
+ isLoading: false,
+ } as any);
- mockUseAllProxyModels.mockReturnValue({
- data: { data: duplicateModels },
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization([]),
isLoading: false,
} as any);
- renderWithProviders(
- ,
- );
+ renderWithProviders();
await waitFor(() => {
- const gpt4Options = screen.getAllByText("gpt-4");
- expect(gpt4Options.length).toBeGreaterThan(0);
+ expect(screen.getByText("gpt-4")).toBeInTheDocument();
+ expect(screen.getByText("claude-3")).toBeInTheDocument();
});
});
- it("should filter models based on user context with includeUserModels option", async () => {
- mockUseCurrentUser.mockReturnValue({
- data: { models: ["gpt-4"] },
+ it("should disable No Default Models when all-proxy-models is selected", async () => {
+ mockUseOrganization.mockReturnValue({
+ data: createMockOrganization(["all-proxy-models"]),
isLoading: false,
} as any);
- renderWithProviders();
+ renderWithProviders(
+ ,
+ );
await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.queryByText("claude-3")).not.toBeInTheDocument();
+ const noDefaultOption = screen.getByRole("option", { name: "No Default Models" });
+ expect(noDefaultOption).toBeDisabled();
});
});
- it("should filter models based on team context", async () => {
- const mockTeam = {
- team_id: "team-1",
- team_alias: "Test Team",
- models: ["gpt-4"],
- };
-
- const mockOrganization: Organization = {
- organization_id: "org-1",
- organization_alias: "Test Org",
- budget_id: "budget-1",
- metadata: {},
- models: ["gpt-4"],
- spend: 0,
- model_spend: {},
- created_at: "2024-01-01",
- created_by: "user-1",
- updated_at: "2024-01-01",
- updated_by: "user-1",
- litellm_budget_table: null,
- teams: null,
- users: null,
- members: null,
- };
+ it("should render maxTagPlaceholder when many items are selected", async () => {
+ // Create many models to trigger maxTagCount responsive behavior
+ const manyModels: ProxyModel[] = Array.from({ length: 20 }, (_, i) => ({
+ id: `model-${i}`,
+ object: "model",
+ created: 1234567890,
+ owned_by: "test",
+ }));
- mockUseTeam.mockReturnValue({
- data: mockTeam,
+ mockUseAllProxyModels.mockReturnValue({
+ data: { data: manyModels },
isLoading: false,
} as any);
- mockUseOrganization.mockReturnValue({
- data: mockOrganization,
- isLoading: false,
- } as any);
+ const selectedValues = manyModels.slice(0, 10).map((m) => m.id);
- renderWithProviders();
+ renderWithProviders(
+ ,
+ );
await waitFor(() => {
- expect(screen.getByText("gpt-4")).toBeInTheDocument();
- expect(screen.queryByText("claude-3")).not.toBeInTheDocument();
+ expect(screen.getByTestId("model-select")).toBeInTheDocument();
+ // Verify maxTagPlaceholder is rendered with omitted values
+ expect(screen.getByTestId("max-tag-placeholder")).toBeInTheDocument();
+ expect(screen.getByText(/\+5 more/)).toBeInTheDocument();
});
});
});
diff --git a/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsx b/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsx
index 78ccdddd81b..2b7399c4565 100644
--- a/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsx
+++ b/ui/litellm-dashboard/src/components/ModelSelect/ModelSelect.tsx
@@ -30,10 +30,11 @@ export interface ModelSelectProps {
showAllProxyModelsOverride?: boolean;
includeSpecialOptions?: boolean;
};
- context: "team" | "organization" | "user";
+ context: "team" | "organization" | "user" | "global";
dataTestId?: string;
value?: string[];
onChange: (values: string[]) => void;
+ style?: React.CSSProperties;
}
type FilterContextArgs = {
@@ -65,6 +66,10 @@ const contextFilters: Record {
return allProxyModels;
},
+
+ global: ({ allProxyModels }) => {
+ return allProxyModels;
+ },
};
const filterModels = (
@@ -84,7 +89,7 @@ const filterModels = (
};
export const ModelSelect = (props: ModelSelectProps) => {
- const { teamID, organizationID, options, context, dataTestId, value = [], onChange } = props;
+ const { teamID, organizationID, options, context, dataTestId, value = [], onChange, style } = props;
const { includeUserModels, showAllTeamModelsOption, showAllProxyModelsOverride, includeSpecialOptions } =
options || {};
const { data: allProxyModels, isLoading: isLoadingAllProxyModels } = useAllProxyModels();
@@ -98,7 +103,7 @@ export const ModelSelect = (props: ModelSelectProps) => {
const organizationHasAllProxyModels = organization?.models.includes(MODEL_SELECT_ALL_PROXY_MODELS_SPECIAL_VALUE.value) || organization?.models.length === 0;
const shouldShowAllProxyModels =
showAllProxyModelsOverride ||
- (organizationHasAllProxyModels && includeSpecialOptions);
+ (organizationHasAllProxyModels && includeSpecialOptions) || context === "global";
if (isLoading) {
return ;
@@ -134,6 +139,7 @@ export const ModelSelect = (props: ModelSelectProps) => {
data-testid={dataTestId}
value={value}
onChange={handleChange}
+ style={style}
options={[
includeSpecialOptions
? {
diff --git a/ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx b/ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx
index f5e43fc3d5f..34085df8f10 100644
--- a/ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx
+++ b/ui/litellm-dashboard/src/components/TeamSSOSettings.test.tsx
@@ -1,63 +1,653 @@
-import { screen } from "@testing-library/react";
+import React from "react";
+import { screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { renderWithProviders } from "../../tests/test-utils";
import TeamSSOSettings from "./TeamSSOSettings";
import * as networking from "./networking";
+import NotificationsManager from "./molecules/notifications_manager";
-// Mock the networking functions
vi.mock("./networking");
-// Mock the budget duration dropdown
+vi.mock("@tremor/react", async (importOriginal) => {
+ const actual = await importOriginal();
+ const React = await import("react");
+ return {
+ ...actual,
+ Card: ({ children }: { children: React.ReactNode }) => React.createElement("div", { "data-testid": "card" }, children),
+ Title: ({ children }: { children: React.ReactNode }) => React.createElement("h2", {}, children),
+ Text: ({ children }: { children: React.ReactNode }) => React.createElement("span", {}, children),
+ Divider: () => React.createElement("hr", {}),
+ TextInput: ({ value, onChange, placeholder, className }: any) =>
+ React.createElement("input", {
+ type: "text",
+ value: value || "",
+ onChange,
+ placeholder,
+ className,
+ }),
+ };
+});
+
vi.mock("./common_components/budget_duration_dropdown", () => ({
default: ({ value, onChange }: { value: string | null; onChange: (value: string) => void }) => (
-