54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
vi.mock('react-router-dom', () => ({
|
|
useLocation: () => ({ pathname: '/e/demo' }),
|
|
useNavigate: () => vi.fn(),
|
|
}));
|
|
|
|
vi.mock('../context/EventDataContext', () => ({
|
|
useEventData: () => ({ token: 'demo' }),
|
|
}));
|
|
|
|
vi.mock('@/guest/i18n/useTranslation', () => ({
|
|
useTranslation: () => ({
|
|
t: (_key: string, fallback?: string) => fallback ?? _key,
|
|
}),
|
|
}));
|
|
|
|
vi.mock('@tamagui/stacks', () => ({
|
|
XStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
|
YStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
|
}));
|
|
|
|
vi.mock('@tamagui/text', () => ({
|
|
SizableText: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
|
|
}));
|
|
|
|
vi.mock('@tamagui/button', () => ({
|
|
Button: ({ children, ...rest }: { children: React.ReactNode }) => (
|
|
<button type="button" {...rest}>
|
|
{children}
|
|
</button>
|
|
),
|
|
}));
|
|
|
|
vi.mock('lucide-react', () => ({
|
|
Home: () => <span>home</span>,
|
|
Image: () => <span>image</span>,
|
|
Share2: () => <span>share</span>,
|
|
}));
|
|
|
|
import BottomDock from '../components/BottomDock';
|
|
|
|
describe('BottomDock', () => {
|
|
it('renders navigation labels', () => {
|
|
render(<BottomDock />);
|
|
|
|
expect(screen.getByText('Home')).toBeInTheDocument();
|
|
expect(screen.getByText('Gallery')).toBeInTheDocument();
|
|
expect(screen.getByText('Share')).toBeInTheDocument();
|
|
});
|
|
});
|