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', () => ({ useParams: () => ({ taskId: '12' }), 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('../services/tasksApi', () => ({ fetchTasks: () => Promise.resolve([{ id: 12, title: 'Capture the dancefloor', description: 'Find the happiest crew.' }]), })); vi.mock('@/guest/i18n/useTranslation', () => ({ useTranslation: () => ({ t: (_key: string, fallback?: string) => fallback ?? _key, locale: 'de' }), })); vi.mock('@/hooks/use-appearance', () => ({ useAppearance: () => ({ resolved: 'light' }), })); import TaskDetailScreen from '../screens/TaskDetailScreen'; describe('TaskDetailScreen', () => { it('renders task title', async () => { render( ); expect(await screen.findByText('Capture the dancefloor')).toBeInTheDocument(); }); });