import React from 'react'; import { describe, expect, it, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; vi.mock('react-router-dom', () => ({ useParams: () => ({ photoId: '123' }), useNavigate: () => vi.fn(), })); 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('../components/SurfaceCard', () => ({ default: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('../components/ShareSheet', () => ({ default: () =>
ShareSheet
, })); vi.mock('../context/EventDataContext', () => ({ useEventData: () => ({ token: 'token', event: { name: 'Demo Event' } }), })); vi.mock('../services/photosApi', () => ({ fetchGallery: vi.fn().mockResolvedValue({ data: [], next_cursor: null, latest_photo_at: null }), fetchPhoto: vi.fn().mockResolvedValue({ id: 123, file_path: 'storage/demo.jpg', likes_count: 5 }), likePhoto: vi.fn().mockResolvedValue(6), createPhotoShareLink: vi.fn().mockResolvedValue({ url: 'http://example.com' }), })); vi.mock('@/guest/i18n/useTranslation', () => ({ useTranslation: () => ({ t: (key: string, arg2?: Record | string, arg3?: string) => typeof arg2 === 'string' || arg2 === undefined ? (arg2 ?? arg3 ?? key) : (arg3 ?? key), }), })); vi.mock('@/guest/i18n/LocaleContext', () => ({ useLocale: () => ({ locale: 'de' }), })); vi.mock('@/hooks/use-appearance', () => ({ useAppearance: () => ({ resolved: 'light' }), })); import PhotoLightboxScreen from '../screens/PhotoLightboxScreen'; describe('PhotoLightboxScreen', () => { it('renders lightbox layout', async () => { render(); expect(await screen.findByText('Gallery')).toBeInTheDocument(); expect(await screen.findByText('Like')).toBeInTheDocument(); }); });