mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-13 06:23:32 +00:00
Adding tests
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user