import React from 'react'; import { describe, expect, it, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; import { EventDataProvider } from '../context/EventDataContext'; vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn(), useSearchParams: () => [new URLSearchParams('taskId=12')], })); 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/button', () => ({ Button: ({ children, ...rest }: { children: React.ReactNode }) => ( ), })); vi.mock('../components/AppShell', () => ({ default: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('../services/uploadApi', () => ({ uploadPhoto: vi.fn(), useUploadQueue: () => ({ items: [], add: vi.fn() }), })); vi.mock('../services/tasksApi', () => ({ fetchTasks: vi.fn().mockResolvedValue([{ id: 12, title: 'Capture the dancefloor', description: 'Find the happiest crew.' }]), })); vi.mock('@/guest/services/pendingUploadsApi', () => ({ fetchPendingUploadsSummary: vi.fn().mockResolvedValue({ items: [], totalCount: 0 }), })); vi.mock('../context/GuestIdentityContext', () => ({ useOptionalGuestIdentity: () => ({ name: 'Alex' }), })); vi.mock('@/guest/hooks/useGuestTaskProgress', () => ({ useGuestTaskProgress: () => ({ markCompleted: vi.fn() }), })); vi.mock('@/guest/i18n/useTranslation', () => ({ useTranslation: () => ({ t: (_key: string, arg2?: Record | string, arg3?: string) => typeof arg2 === 'string' || arg2 === undefined ? (arg2 ?? arg3 ?? _key) : (arg3 ?? _key), locale: 'en', }), })); vi.mock('@/hooks/use-appearance', () => ({ useAppearance: () => ({ resolved: 'light' }), })); import UploadScreen from '../screens/UploadScreen'; describe('UploadScreen', () => { it('renders queue entry point', () => { render( ); expect(screen.getByText('Queue')).toBeInTheDocument(); }); it('renders task summary when taskId is present', async () => { render( ); expect(await screen.findByText('Capture the dancefloor')).toBeInTheDocument(); }); });