import React from 'react'; import { describe, expect, it, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; const navigateMock = vi.fn(); vi.mock('react-router-dom', () => ({ useNavigate: () => navigateMock, useParams: () => ({ slug: 'demo-event' }), })); 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: 'de' }, }), })); vi.mock('../../context/EventContext', () => ({ useEventContext: () => ({ activeEvent: { slug: 'demo-event' }, selectEvent: vi.fn(), }), })); vi.mock('../../api', () => ({ getEvents: vi.fn().mockResolvedValue([]), listGuestNotifications: vi.fn().mockResolvedValue([]), sendGuestNotification: vi.fn(), })); vi.mock('react-hot-toast', () => ({ default: { error: vi.fn(), success: vi.fn(), }, })); vi.mock('../../auth/tokens', () => ({ isAuthError: () => false, })); vi.mock('../../lib/apiError', () => ({ getApiErrorMessage: () => 'error', })); vi.mock('../guestMessages', () => ({ formatGuestMessageDate: () => '19. Feb. 2026', })); vi.mock('../hooks/useBackNavigation', () => ({ useBackNavigation: () => undefined, })); 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/FormControls', () => ({ MobileField: ({ children }: { children: React.ReactNode }) =>
{children}
, MobileInput: (props: React.InputHTMLAttributes) => , MobileSelect: ({ children }: { children: React.ReactNode }) => , MobileTextArea: (props: React.TextareaHTMLAttributes) =>