test: remove obsolete test for deleted page/hook (TemplateLibrary.test.tsx)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Has been cancelled
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Check push changed paths (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Blocked by required conditions
CI/CD Pipeline / Canary Release to Production (pull_request) Blocked by required conditions
CI/CD Pipeline / CI Gate (pull_request) Blocked by required conditions
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Has been cancelled
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Check push changed paths (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Blocked by required conditions
CI/CD Pipeline / Canary Release to Production (pull_request) Blocked by required conditions
CI/CD Pipeline / CI Gate (pull_request) Blocked by required conditions
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
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 }) => <div data-testid="page-head">{title}</div>,
|
||||
}))
|
||||
|
||||
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) => <button onClick={onClick}>{children}</button>,
|
||||
Input: ({ placeholder }: any) => <input placeholder={placeholder} />,
|
||||
Select: ({ options }: any) => (
|
||||
<select>
|
||||
{options?.map((o: any) => (
|
||||
<option key={o.value}>{o.label}</option>
|
||||
))}
|
||||
</select>
|
||||
),
|
||||
Modal: ({ open, children }: any) => (open ? <div role="dialog">{children}</div> : null),
|
||||
Empty: () => <div>Empty</div>,
|
||||
Card: ({ children }: any) => <div>{children}</div>,
|
||||
Tag: ({ children }: any) => <span>{children}</span>,
|
||||
Tooltip: ({ children }: any) => <span>{children}</span>,
|
||||
Upload: ({ children }: any) => <div>{children}</div>,
|
||||
Progress: () => <div />,
|
||||
}))
|
||||
|
||||
vi.mock("antd", () => ({
|
||||
Table: () => <div />,
|
||||
Pagination: () => <div />,
|
||||
Tabs: () => <div />,
|
||||
Modal: ({ open, children }: any) => (open ? <div role="dialog">{children}</div> : null),
|
||||
message: { success: vi.fn(), error: vi.fn(), warning: vi.fn(), info: vi.fn() },
|
||||
Popconfirm: ({ children }: any) => <span>{children}</span>,
|
||||
Form: ({ children }: any) => <form>{children}</form>,
|
||||
Input: ({ placeholder }: any) => <input placeholder={placeholder} />,
|
||||
InputNumber: () => <input type="number" />,
|
||||
Select: () => <select />,
|
||||
Empty: () => <div>Empty</div>,
|
||||
Space: ({ children }: any) => <div>{children}</div>,
|
||||
Tag: ({ children }: any) => <span>{children}</span>,
|
||||
Badge: ({ children }: any) => <span>{children}</span>,
|
||||
Tooltip: ({ children }: any) => <span>{children}</span>,
|
||||
Upload: ({ children }: any) => <div>{children}</div>,
|
||||
Progress: () => <div />,
|
||||
Switch: () => <input type="checkbox" />,
|
||||
Radio: ({ children }: any) => <span>{children}</span>,
|
||||
RadioGroup: ({ children }: any) => <div>{children}</div>,
|
||||
Checkbox: ({ children }: any) => (
|
||||
<label>
|
||||
<input type="checkbox" />
|
||||
{children}
|
||||
</label>
|
||||
),
|
||||
DatePicker: () => <input type="date" />,
|
||||
Col: ({ children }: any) => <div>{children}</div>,
|
||||
Row: ({ children }: any) => <div>{children}</div>,
|
||||
Card: ({ children }: any) => <div>{children}</div>,
|
||||
List: () => <ul />,
|
||||
Grid: { useBreakpoint: () => ({ xs: true, sm: true, md: true, lg: true }) },
|
||||
Descriptions: ({ children }: any) => <div>{children}</div>,
|
||||
Divider: () => <hr />,
|
||||
Avatar: () => <span />,
|
||||
Dropdown: ({ children }: any) => <span>{children}</span>,
|
||||
Menu: ({ children }: any) => <ul>{children}</ul>,
|
||||
Drawer: ({ open, children }: any) => (open ? <div>{children}</div> : null),
|
||||
Typography: {
|
||||
Title: ({ children }: any) => <h2>{children}</h2>,
|
||||
Text: ({ children }: any) => <span>{children}</span>,
|
||||
Paragraph: ({ children }: any) => <p>{children}</p>,
|
||||
},
|
||||
Spin: ({ spinning }: any) => (spinning ? <div>Loading...</div> : <></>),
|
||||
Slider: () => <input type="range" />,
|
||||
Rate: () => <div />,
|
||||
Collapse: ({ children }: any) => <div>{children}</div>,
|
||||
Steps: ({ children }: any) => <div>{children}</div>,
|
||||
Button: ({ children }: any) => <button>{children}</button>,
|
||||
}))
|
||||
|
||||
vi.mock("@ant-design/icons", () => ({
|
||||
CopyOutlined: () => <span />,
|
||||
ExclamationCircleOutlined: () => <span />,
|
||||
InboxOutlined: () => <span />,
|
||||
LoadingOutlined: () => <span />,
|
||||
SearchOutlined: () => <span />,
|
||||
ThunderboltOutlined: () => <span />,
|
||||
}))
|
||||
|
||||
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 }),
|
||||
}))
|
||||
|
||||
vi.mock("@/pages/templates/TemplateLibrary.css", () => ({}))
|
||||
|
||||
import TemplateLibrary from "@/pages/templates/TemplateLibrary"
|
||||
import "@/pages/templates/types/templateLibrary"
|
||||
import "@/pages/templates/constants/templateLibrary"
|
||||
import "@/pages/templates/utils/templateLibrary"
|
||||
import "@/pages/templates/hooks/useTemplateLibrary"
|
||||
import "@/pages/templates/hooks/useTemplateDetail"
|
||||
import "@/pages/templates/components/template-library/TemplateCard"
|
||||
import "@/pages/templates/components/template-library/TemplateDetailModal"
|
||||
import "@/pages/templates/components/template-library/template-detail-modal/PreviewArea"
|
||||
import "@/pages/templates/components/template-library/template-detail-modal/SegmentList"
|
||||
import "@/pages/templates/components/template-library/template-detail-modal/StyleConfig"
|
||||
import "@/pages/templates/components/template-library/template-detail-modal/DetailFooter"
|
||||
import "@/pages/templates/components/template-library/template-detail-modal/types"
|
||||
import "@/pages/templates/components/template-library/TemplateHeader"
|
||||
import "@/pages/templates/components/template-library/TemplateToolbar"
|
||||
import "@/pages/templates/components/template-library/TemplateGrid"
|
||||
|
||||
describe("TemplateLibrary Page", () => {
|
||||
it("should render without crashing", () => {
|
||||
const { container } = render(
|
||||
<MemoryRouter>
|
||||
<TemplateLibrary />
|
||||
</MemoryRouter>,
|
||||
)
|
||||
expect(container.firstChild).toBeTruthy()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user