import { render, screen, waitFor } from '@testing-library/react' import { describe, expect, it, vi, beforeEach } from 'vitest' import App from '../App' vi.mock('../pages/public/LandingPage', () => ({ LandingPage: () =>
landing-page
, })) vi.mock('../pages/public/LoginPage', () => ({ LoginPage: () =>
login-page
, })) vi.mock('../pages/dashboard/DashboardPage', () => ({ DashboardPage: () =>
dashboard-page
, })) vi.mock('../pages/dashboard/customers/CustomerListPage', () => ({ CustomerListPage: () =>
customer-list-page
, })) vi.mock('../pages/dashboard/customers/CustomerFormPage', () => ({ CustomerFormPage: () =>
customer-form-new
, })) vi.mock('../pages/dashboard/customers/CustomerDetailPage', () => ({ CustomerDetailPage: () =>
customer-detail-page
, })) vi.mock('../pages/dashboard/templates/TemplateListPage', () => ({ TemplateListPage: () =>
template-list-page
, })) vi.mock('../pages/dashboard/templates/TemplateFormPage', () => ({ TemplateFormPage: () =>
template-form-page
, })) vi.mock('../pages/dashboard/templates/TemplateDetailPage', () => ({ TemplateDetailPage: () =>
template-detail-page
, })) vi.mock('../pages/dashboard/templates/TemplateMakeTaskPage', () => ({ TemplateMakeTaskPage: () =>
template-make-task-page
, })) vi.mock('../pages/dashboard/templates/TemplateEditPage', () => ({ TemplateEditPage: () =>
template-edit-page
, })) vi.mock('../pages/dashboard/simulation/StylistSimulationPage', () => ({ StylistSimulationPage: () =>
simulation-page
, })) vi.mock('../pages/dashboard/simulation/SimulationResultPage', () => ({ SimulationResultPage: () =>
simulation-result-page
, })) vi.mock('../pages/dashboard/simulation/SimulationEditPage', () => ({ SimulationEditPage: () =>
simulation-edit-page
, })) vi.mock('../pages/dashboard/simulation/AftercareResultPage', () => ({ AftercareResultPage: () =>
aftercare-result-page
, })) vi.mock('../pages/customer/StylistProfilePage', () => ({ StylistProfilePage: () =>
stylist-profile-page
, })) vi.mock('../pages/customer/CustomerSimulationPage', () => ({ CustomerSimulationPage: () =>
customer-simulation-page
, })) vi.mock('../shared/RequireAuth', () => ({ RequireAuth: ({ children }: { children: React.ReactNode }) => <>{children}, })) describe('App customer routes', () => { beforeEach(() => { window.history.replaceState({}, '', '/zh') }) it('renders customer detail route', async () => { window.history.replaceState({}, '', '/zh/customers/123') render() await waitFor(() => { expect(screen.getByText('customer-detail-page')).toBeInTheDocument() }) }) it('renders customer edit route with the shared form page', async () => { window.history.replaceState({}, '', '/zh/customers/123/edit') render() await waitFor(() => { expect(screen.getByText('customer-form-new')).toBeInTheDocument() }) }) it('renders simulation result detail route with simulationId param', async () => { window.history.replaceState({}, '', '/zh/simulation/result/91') render() await waitFor(() => { expect(screen.getByText('simulation-result-page')).toBeInTheDocument() }) }) it('renders template make task route', async () => { window.history.replaceState({}, '', '/zh/templates/tasks/88') render() await waitFor(() => { expect(screen.getByText('template-make-task-page')).toBeInTheDocument() }) }) it('renders template edit route', async () => { window.history.replaceState({}, '', '/zh/templates/101/edit') render() await waitFor(() => { expect(screen.getByText('template-edit-page')).toBeInTheDocument() }) }) })