import React from 'react'; import { describe, expect, it, vi } 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-19', status: 'published', settings: { guest_downloads_enabled: true, guest_sharing_enabled: false, }, }, stats: { photo_count: 12, like_count: 3, pending_count: 1, guest_count: 22, }, invites: [], addons: [], })); vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn(), 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; }, }), })); vi.mock('../hooks/useBackNavigation', () => ({ useBackNavigation: () => undefined, })); vi.mock('../../api', () => ({ getEvent: vi.fn().mockResolvedValue(fixtures.event), getEventStats: vi.fn().mockResolvedValue(fixtures.stats), getEventQrInvites: vi.fn().mockResolvedValue(fixtures.invites), getAddonCatalog: vi.fn().mockResolvedValue(fixtures.addons), updateEvent: vi.fn().mockResolvedValue(fixtures.event), createEventAddonCheckout: vi.fn(), })); vi.mock('../../auth/tokens', () => ({ isAuthError: () => false, })); vi.mock('../../lib/apiError', () => ({ getApiErrorMessage: () => 'error', })); vi.mock('../components/MobileShell', () => ({ MobileShell: ({ children }: { children: React.ReactNode }) =>
{children}
, HeaderActionButton: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('../components/Primitives', () => ({ MobileCard: ({ children }: { children: React.ReactNode }) =>
{children}
, CTAButton: ({ label }: { label: string }) => , PillBadge: ({ children }: { children: React.ReactNode }) =>
{children}
, SkeletonCard: () =>
Loading...
, })); vi.mock('../components/LegalConsentSheet', () => ({ LegalConsentSheet: () =>
, })); vi.mock('@tamagui/stacks', () => ({ YStack: ({ children }: { children: React.ReactNode }) =>
{children}
, XStack: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('@tamagui/text', () => ({ SizableText: ({ children }: { children: React.ReactNode }) => {children}, })); vi.mock('@tamagui/react-native-web-lite', () => ({ Pressable: ({ children, onPress }: { children: React.ReactNode; onPress?: () => void }) => ( ), })); vi.mock('@tamagui/switch', () => ({ Switch: Object.assign( ({ children, checked, onCheckedChange, 'aria-label': ariaLabel }: any) => ( ), { Thumb: () => }, ), })); vi.mock('../theme', () => ({ useAdminTheme: () => ({ text: '#111827', muted: '#6b7280', subtle: '#94a3b8', border: '#e5e7eb', primary: '#ff5a5f', successText: '#16a34a', danger: '#dc2626', surface: '#ffffff', surfaceMuted: '#f9fafb', accentSoft: '#eef2ff', textStrong: '#0f172a', }), })); import MobileEventRecapPage from '../EventRecapPage'; describe('MobileEventRecapPage', () => { it('renders recap settings toggles', async () => { render(); expect(await screen.findByText('Nachlauf-Optionen')).toBeInTheDocument(); expect(screen.getByLabelText('Gäste dürfen Fotos laden')).toBeInTheDocument(); expect(screen.getByLabelText('Gäste dürfen Fotos teilen')).toBeInTheDocument(); }); });