import React from 'react'; import { describe, expect, it, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; const navigateMock = vi.fn(); const tMock = ( _key: string, fallback?: string | Record, options?: Record, ) => { let value = typeof fallback === 'string' ? fallback : _key; if (options) { Object.entries(options).forEach(([key, val]) => { value = value.replaceAll(`{{${key}}}`, String(val)); }); } return value; }; vi.mock('react-router-dom', () => ({ useNavigate: () => navigateMock, })); vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: tMock }), initReactI18next: { type: '3rdParty', init: () => undefined, }, })); vi.mock('../hooks/useBackNavigation', () => ({ useBackNavigation: () => vi.fn(), })); vi.mock('../theme', () => ({ useAdminTheme: () => ({ textStrong: '#111827', text: '#111827', muted: '#6b7280', border: '#e5e7eb', danger: '#b91c1c', }), })); 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, onPress }: { label: string; onPress?: () => void }) => ( ), PillBadge: ({ children }: { children: React.ReactNode }) => {children}, SkeletonCard: () =>
Loading...
, })); vi.mock('../components/FormControls', () => ({ MobileSelect: ({ children, ...props }: { children: React.ReactNode }) => ( ), })); 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/switch', () => ({ Switch: Object.assign( ({ children }: { children: React.ReactNode }) =>
{children}
, { Thumb: () =>
}, ), })); vi.mock('@tamagui/react-native-web-lite', () => ({ Pressable: ({ children, onPress, ...rest }: { children: React.ReactNode; onPress?: () => void; [key: string]: unknown; }) => ( ), FlatList: ({ data = [], renderItem }: { data?: unknown[]; renderItem?: (info: any) => React.ReactNode }) => (
{renderItem ? data.map((item, index) => renderItem({ item, index })) : null}
), })); vi.mock('../../api', () => ({ listTenantDataExports: vi.fn().mockResolvedValue([]), getEvents: vi.fn().mockResolvedValue([]), requestTenantDataExport: vi.fn(), downloadTenantDataExport: vi.fn(), })); import MobileDataExportsPage from '../DataExportsPage'; describe('MobileDataExportsPage', () => { it('renders account scope label', async () => { render(); expect(await screen.findByText('Account')).toBeInTheDocument(); }); });