Skip to content

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]

tests

yuneng-jiang546fba98498d
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.test.tsx
new file mode 100644
index 00000000000..13363a11643
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/AddSSOSettingsModal.test.tsx
@@ -0,0 +1,26 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import AddSSOSettingsModal from "./AddSSOSettingsModal";
+
+// Mock networking functions
+vi.mock("@/components/networking", () => ({
+ updateSSOSettings: vi.fn(),
+}));
+
+// Mock error utils
+vi.mock("@/components/shared/errorUtils", () => ({
+ parseErrorMessage: vi.fn((error) => error?.message || "Unknown error"),
+}));
+
+describe("AddSSOSettingsModal", () => {
+ it("should render", () => {
+ const onCancel = vi.fn();
+ const onSuccess = vi.fn();
+
+ render(<AddSSOSettingsModal isVisible={true} onCancel={onCancel} onSuccess={onSuccess} accessToken="test-token" />);
+
+ expect(screen.getByText("SSO Provider")).toBeInTheDocument();
+ expect(screen.getByText("Cancel")).toBeInTheDocument();
+ expect(screen.getAllByText("Add SSO")).toHaveLength(2); // Title and button
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/DeleteSSOSettingsModal.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/DeleteSSOSettingsModal.test.tsx
new file mode 100644
index 00000000000..ef6ec6c7055
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/Modals/DeleteSSOSettingsModal.test.tsx
@@ -0,0 +1,20 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import DeleteSSOSettingsModal from "./DeleteSSOSettingsModal";
+
+describe("DeleteSSOSettingsModal", () => {
+ it("should render", () => {
+ const onCancel = vi.fn();
+ const onSuccess = vi.fn();
+
+ render(
+ <DeleteSSOSettingsModal isVisible={true} onCancel={onCancel} onSuccess={onSuccess} accessToken="test-token" />,
+ );
+
+ expect(screen.getByText("Confirm Clear SSO Settings")).toBeInTheDocument();
+ expect(
+ screen.getByText("Are you sure you want to clear all SSO settings? This action cannot be undone."),
+ ).toBeInTheDocument();
+ expect(screen.getByText("Users will no longer be able to login using SSO after this change.")).toBeInTheDocument();
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettings.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettings.test.tsx
new file mode 100644
index 00000000000..5e7908a872b
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettings.test.tsx
@@ -0,0 +1,37 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import SSOSettings from "./SSOSettings";
+
+// Mock the useSSOSettings hook
+vi.mock("@/app/(dashboard)/hooks/sso/useSSOSettings", () => ({
+ useSSOSettings: () => ({
+ data: null,
+ refetch: vi.fn(),
+ }),
+}));
+
+const createQueryClient = () =>
+ new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: false,
+ gcTime: 0,
+ },
+ },
+ });
+
+describe("SSOSettings", () => {
+ it("should render", () => {
+ const queryClient = createQueryClient();
+
+ render(
+ <QueryClientProvider client={queryClient}>
+ <SSOSettings />
+ </QueryClientProvider>,
+ );
+
+ expect(screen.getByText("SSO Configuration")).toBeInTheDocument();
+ expect(screen.getByText("Manage Single Sign-On authentication settings")).toBeInTheDocument();
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettingsEmptyPlaceholder.test.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettingsEmptyPlaceholder.test.tsx
new file mode 100644
index 00000000000..6676ba1c2c9
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/SSOSettings/SSOSettingsEmptyPlaceholder.test.tsx
@@ -0,0 +1,14 @@
+import { render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import SSOSettingsEmptyPlaceholder from "./SSOSettingsEmptyPlaceholder";
+
+describe("SSOSettingsEmptyPlaceholder", () => {
+ it("should render", () => {
+ const onAdd = vi.fn();
+
+ render(<SSOSettingsEmptyPlaceholder onAdd={onAdd} />);
+
+ expect(screen.getByText("No SSO Configuration Found")).toBeInTheDocument();
+ expect(screen.getByText("Configure SSO")).toBeInTheDocument();
+ });
+});