import React from "react" import { describe, expect, it, vi } from "vitest" import { render } from "@testing-library/react" import { MemoryRouter } from "react-router-dom" vi.mock("@/components/layout/PageHead", () => ({ default: ({ title }: { title: string }) =>
{title}
, })) vi.mock("@tanstack/react-query", () => ({ useQuery: () => ({ data: [], isLoading: false, isError: false, refetch: vi.fn() }), useMutation: () => ({ mutate: vi.fn(), mutateAsync: vi.fn(), isLoading: false }), useQueryClient: () => ({ invalidateQueries: vi.fn(), setQueryData: vi.fn() }), useInfiniteQuery: () => ({ data: { pages: [] }, isLoading: false, fetchNextPage: vi.fn(), hasNextPage: false, }), })) vi.mock("@/components/ui", () => ({ Button: ({ children, onClick }: any) => , Input: ({ placeholder }: any) => , Select: ({ options }: any) => ( ), Modal: ({ open, children }: any) => (open ?
{children}
: null), Empty: () =>
Empty
, Card: ({ children }: any) =>
{children}
, Tag: ({ children }: any) => {children}, Tooltip: ({ children }: any) => {children}, Upload: ({ children }: any) =>
{children}
, Progress: () =>
, })) vi.mock("antd", () => ({ Table: () =>
, Pagination: () =>
, Tabs: () =>
, Modal: ({ open, children }: any) => (open ?
{children}
: null), message: { success: vi.fn(), error: vi.fn(), warning: vi.fn(), info: vi.fn() }, Popconfirm: ({ children }: any) => {children}, Form: ({ children }: any) =>
{children}
, Input: ({ placeholder }: any) => , InputNumber: () => , Select: () => , Radio: ({ children }: any) => {children}, RadioGroup: ({ children }: any) =>
{children}
, Checkbox: ({ children }: any) => ( ), DatePicker: () => , Col: ({ children }: any) =>
{children}
, Row: ({ children }: any) =>
{children}
, Card: ({ children }: any) =>
{children}
, List: () =>
    , Grid: { useBreakpoint: () => ({ xs: true, sm: true, md: true, lg: true }) }, Descriptions: ({ children }: any) =>
    {children}
    , Divider: () =>
    , Avatar: () => , Dropdown: ({ children }: any) => {children}, Menu: ({ children }: any) =>
      {children}
    , Drawer: ({ open, children }: any) => (open ?
    {children}
    : null), Typography: { Title: ({ children }: any) =>

    {children}

    , Text: ({ children }: any) => {children}, Paragraph: ({ children }: any) =>

    {children}

    , }, Spin: ({ spinning }: any) => (spinning ?
    Loading...
    : <>), Slider: () => , Rate: () =>
    , Collapse: ({ children }: any) =>
    {children}
    , Steps: ({ children }: any) =>
    {children}
    , Button: ({ children }: any) => , })) vi.mock("@ant-design/icons", () => ({ CopyOutlined: () => , ExclamationCircleOutlined: () => , InboxOutlined: () => , LoadingOutlined: () => , SearchOutlined: () => , ThunderboltOutlined: () => , })) vi.mock("@/store/authStore", () => ({ useAuthStore: (sel: any) => sel({ user: { id: "1", vip_level: 0 }, isAuthenticated: true }), })) vi.mock("@/api/templates", () => ({ getTemplates: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), getTemplatesList: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), getTemplate: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), toggleFavoriteTemplate: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), copyTemplate: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), generateFromTemplate: vi.fn().mockResolvedValue({ items: [], total: 0, success: true }), })) vi.mock("@/pages/templates/TemplateLibrary.css", () => ({})) import TemplateLibrary from "@/pages/templates/TemplateLibrary" describe("TemplateLibrary Page", () => { it("should render without crashing", () => { const { container } = render( , ) expect(container.firstChild).toBeTruthy() }) })