Files
fotospiel-app/resources/js/guest-v2/__tests__/EventLogo.test.tsx
Codex Agent 298a8375b6
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Update guest v2 branding and theming
2026-02-03 15:18:44 +01:00

60 lines
1.6 KiB
TypeScript

import React from 'react';
import { render, screen } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import EventLogo from '../components/EventLogo';
import { EventBrandingProvider } from '@/guest/context/EventBrandingContext';
import type { EventBranding } from '@/guest/types/event-branding';
vi.mock('@tamagui/stacks', () => ({
YStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));
vi.mock('@tamagui/text', () => ({
SizableText: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
}));
const baseBranding: EventBranding = {
primaryColor: '#ff5a5f',
secondaryColor: '#fbcfe8',
backgroundColor: '#fff7f5',
fontFamily: null,
logoUrl: null,
logo: {
mode: 'emoticon',
value: '🎉',
size: 'm',
},
mode: 'auto',
};
describe('EventLogo', () => {
it('renders an uploaded logo image when configured', () => {
const branding: EventBranding = {
...baseBranding,
logo: {
mode: 'upload',
value: 'https://example.com/logo.png',
size: 'm',
},
};
render(
<EventBrandingProvider branding={branding}>
<EventLogo name="Demo Event" />
</EventBrandingProvider>
);
expect(screen.getByAltText('Demo Event')).toBeInTheDocument();
});
it('renders an emoji fallback when configured', () => {
render(
<EventBrandingProvider branding={baseBranding}>
<EventLogo name="Demo Event" />
</EventBrandingProvider>
);
expect(screen.getByText('🎉')).toBeInTheDocument();
});
});