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]

Adding tests

yuneng-jiang5cd482cd057e
diff --git a/ui/litellm-dashboard/src/components/common_components/NewBadge.test.tsx b/ui/litellm-dashboard/src/components/common_components/NewBadge.test.tsx
index a24b52db6b8..2500551d37b 100644
--- a/ui/litellm-dashboard/src/components/common_components/NewBadge.test.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/NewBadge.test.tsx
@@ -49,4 +49,39 @@ describe("NewBadge", () => {
expect(container.firstChild).toBeNull();
});
+
+ it("should render badge with dot when dot prop is true", () => {
+ mockUseDisableShowNewBadge.mockReturnValue(false);
+
+ render(<NewBadge dot={true}>Test Content</NewBadge>);
+
+ expect(screen.queryByText("New")).not.toBeInTheDocument();
+ expect(screen.getByText("Test Content")).toBeInTheDocument();
+ });
+
+ it("should render badge with 'New' text when dot prop is false", () => {
+ mockUseDisableShowNewBadge.mockReturnValue(false);
+
+ render(<NewBadge dot={false}>Test Content</NewBadge>);
+
+ expect(screen.getByText("New")).toBeInTheDocument();
+ expect(screen.getByText("Test Content")).toBeInTheDocument();
+ });
+
+ it("should render badge with 'New' text when dot prop is not provided (defaults to false)", () => {
+ mockUseDisableShowNewBadge.mockReturnValue(false);
+
+ render(<NewBadge>Test Content</NewBadge>);
+
+ expect(screen.getByText("New")).toBeInTheDocument();
+ expect(screen.getByText("Test Content")).toBeInTheDocument();
+ });
+
+ it("should render badge with dot when dot is true and no children", () => {
+ mockUseDisableShowNewBadge.mockReturnValue(false);
+
+ render(<NewBadge dot={true} />);
+
+ expect(screen.queryByText("New")).not.toBeInTheDocument();
+ });
});
diff --git a/ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.tsx b/ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.tsx
index 007036a9c9d..29194ce9fcd 100644
--- a/ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/SpendLogsSettingsModal/SpendLogsSettingsModal.tsx
@@ -1,13 +1,13 @@
"use client";
+import { ConfigType, GeneralSettingsFieldName, useDeleteProxyConfigField, useProxyConfig } from "@/app/(dashboard)/hooks/proxyConfig/useProxyConfig";
import { StoreRequestInSpendLogsParams, useStoreRequestInSpendLogs } from "@/app/(dashboard)/hooks/storeRequestInSpendLogs/useStoreRequestInSpendLogs";
-import { ConfigType, useProxyConfig, useDeleteProxyConfigField, GeneralSettingsFieldName } from "@/app/(dashboard)/hooks/proxyConfig/useProxyConfig";
+import NewBadge from "@/components/common_components/NewBadge";
import NotificationsManager from "@/components/molecules/notifications_manager";
import { parseErrorMessage } from "@/components/shared/errorUtils";
import { ClockCircleOutlined } from "@ant-design/icons";
import { Button, Form, Input, Modal, Skeleton, Space, Switch, Typography } from "antd";
import React, { useEffect, useMemo } from "react";
-import NewBadge from "@/components/common_components/NewBadge";
interface SpendLogsSettingsModalProps {
isVisible: boolean;