Adding tests

This commit is contained in:
yuneng-jiang
2026-01-29 14:17:59 -08:00
parent ca8056f74f
commit 5cd482cd05
2 changed files with 37 additions and 2 deletions
@@ -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();
});
});
@@ -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;