Files
fotospiel-app/resources/js/guest/components/__tests__/GalleryPreview.test.tsx

49 lines
1.3 KiB
TypeScript

import React from 'react';
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import GalleryPreview from '../GalleryPreview';
vi.mock('../../polling/usePollGalleryDelta', () => ({
usePollGalleryDelta: () => ({
photos: [],
loading: false,
}),
}));
vi.mock('../../i18n/useTranslation', () => ({
useTranslation: () => ({
locale: 'de',
}),
}));
vi.mock('../../context/EventBrandingContext', () => ({
useEventBranding: () => ({
branding: {
primaryColor: '#f43f5e',
secondaryColor: '#fb7185',
buttons: { radius: 12, linkColor: '#fb7185' },
typography: {},
fontFamily: 'Montserrat',
},
}),
}));
describe('GalleryPreview', () => {
it('renders dark mode-ready surfaces', () => {
render(
<MemoryRouter>
<GalleryPreview token="demo" />
</MemoryRouter>,
);
const card = screen.getByTestId('gallery-preview');
expect(card.className).toContain('bg-[var(--guest-surface)]');
expect(card.className).toContain('dark:bg-slate-950/70');
const emptyState = screen.getByText(/Noch keine Fotos/i).closest('div');
expect(emptyState).not.toBeNull();
expect(emptyState?.className).toContain('dark:bg-slate-950/60');
});
});