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,
Navigate: ({ to }: { to: string }) =>
{to}
,
}));
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: () => ({
events: [{ slug: 'demo-event', event_date: '2026-02-19' }],
activeEvent: null,
hasEvents: true,
selectEvent: vi.fn(),
}),
}));
vi.mock('../../lib/events', () => ({
resolveEventDisplayName: () => 'Demo Event',
formatEventDate: () => '19. Feb. 2026',
}));
vi.mock('../components/MobileShell', () => ({
MobileShell: ({ children }: { children: React.ReactNode }) => {children}
,
}));
vi.mock('../components/Primitives', () => ({
CTAButton: ({ label }: { label: string }) => ,
}));
vi.mock('@tamagui/card', () => ({
Card: ({ children }: { children: React.ReactNode }) => {children}
,
}));
vi.mock('@tamagui/group', () => ({
YGroup: Object.assign(({ children }: { children: React.ReactNode }) => {children}
, {
Item: ({ children }: { children: React.ReactNode }) => {children}
,
}),
}));
vi.mock('@tamagui/list-item', () => ({
ListItem: ({ title, iconAfter }: { title?: React.ReactNode; iconAfter?: React.ReactNode }) => (
{title}
{iconAfter}
),
}));
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('../theme', () => ({
useAdminTheme: () => ({
text: '#111827',
muted: '#6b7280',
border: '#e5e7eb',
primary: '#ff5a5f',
surface: '#ffffff',
surfaceMuted: '#f9fafb',
shadow: 'rgba(15,23,42,0.12)',
}),
}));
import MobileUploadsTabPage from '../UploadsTabPage';
describe('MobileUploadsTabPage', () => {
it('renders the event picker list', () => {
render();
expect(screen.getByText('Pick an event to manage uploads')).toBeInTheDocument();
expect(screen.getByText('Demo Event')).toBeInTheDocument();
expect(screen.getByText('Open')).toBeInTheDocument();
});
});