import React from 'react'; import { describe, expect, it, vi, beforeEach } from 'vitest'; import { render, screen } from '@testing-library/react'; const fixtures = vi.hoisted(() => ({ event: { id: 1, name: 'Demo Event', slug: 'demo-event', event_date: '2026-02-12', event_type_id: 1, event_type: { id: 1, name: 'Wedding' }, status: 'published', settings: { live_show: { moderation_mode: 'manual', }, }, }, })); vi.mock('react-router-dom', () => ({ useParams: () => ({ slug: fixtures.event.slug }), })); vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string, fallback?: string | Record) => { if (typeof fallback === 'string') { return fallback; } if (fallback && typeof fallback === 'object' && typeof fallback.defaultValue === 'string') { return fallback.defaultValue; } return key; }, i18n: { language: 'en' }, }), })); vi.mock('../../api', () => ({ getEvent: vi.fn(), getLiveShowLink: vi.fn(), rotateLiveShowLink: vi.fn(), updateEvent: vi.fn(), })); vi.mock('../../auth/tokens', () => ({ isAuthError: () => false, })); vi.mock('../../lib/apiError', () => ({ getApiErrorMessage: () => 'error', })); vi.mock('../../lib/events', () => ({ resolveEventDisplayName: () => fixtures.event.name, })); vi.mock('../hooks/useBackNavigation', () => ({ useBackNavigation: () => undefined, })); vi.mock('../components/MobileShell', () => ({ MobileShell: ({ children }: { children: React.ReactNode }) =>
{children}
, HeaderActionButton: ({ children, onPress }: { children: React.ReactNode; onPress?: () => void }) => ( ), })); vi.mock('../components/Primitives', () => ({ MobileCard: ({ children }: { children: React.ReactNode }) =>
{children}
, CTAButton: ({ label, onPress, disabled }: { label: string; onPress?: () => void; disabled?: boolean }) => ( ), SkeletonCard: () =>
Loading...
, })); vi.mock('../components/FormControls', () => ({ MobileField: ({ label, children }: { label: string; children: React.ReactNode }) => ( ), MobileInput: (props: React.InputHTMLAttributes) => , MobileSelect: (props: React.SelectHTMLAttributes) =>