import React from 'react'; import { describe, expect, it, vi } from 'vitest'; import { render, screen } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; import GalleryPage from '../GalleryPage'; import { LocaleProvider } from '../../i18n/LocaleContext'; vi.mock('../../polling/usePollGalleryDelta', () => ({ usePollGalleryDelta: () => ({ photos: [], loading: false, newCount: 0, acknowledgeNew: vi.fn(), refreshNow: vi.fn(), }), })); vi.mock('../../context/EventBrandingContext', () => ({ useEventBranding: () => ({ branding: { primaryColor: '#FF5A5F', secondaryColor: '#FFF8F5', fontFamily: 'Space Grotesk, sans-serif', buttons: { radius: 12, style: 'filled', linkColor: '#FF5A5F' }, typography: { heading: 'Space Grotesk, sans-serif', body: 'Space Grotesk, sans-serif' }, }, }), })); vi.mock('../../context/EventStatsContext', () => ({ useEventStats: () => ({ likesCount: 12, guestCount: 5, onlineGuests: 2, tasksSolved: 0, latestPhotoAt: null, loading: false, eventKey: 'demo', slug: 'demo', }), })); vi.mock('../../services/eventApi', () => ({ fetchEvent: vi.fn().mockResolvedValue({ name: 'Demo Event' }), })); vi.mock('../../components/ToastHost', () => ({ useToast: () => ({ push: vi.fn() }), })); vi.mock('../../components/ShareSheet', () => ({ default: () => null, })); vi.mock('../PhotoLightbox', () => ({ default: () => null, })); vi.mock('../../components/PullToRefresh', () => ({ default: ({ children }: { children: React.ReactNode }) =>
{children}
, })); vi.mock('../../components/FiltersBar', () => ({ default: () =>
, })); describe('GalleryPage hero CTA', () => { it('links to the upload page', async () => { render( } /> ); const link = await screen.findByRole('link', { name: /neues foto hochladen/i }); expect(link).toHaveAttribute('href', '/e/demo/upload'); }); });