59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import React from 'react';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
vi.mock('@/guest/i18n/useTranslation', () => ({
|
|
useTranslation: () => ({ t: (_key: string, fallback?: string) => fallback ?? _key }),
|
|
}));
|
|
|
|
vi.mock('@/hooks/use-appearance', () => ({
|
|
useAppearance: () => ({ resolved: 'dark' }),
|
|
}));
|
|
|
|
vi.mock('@/guest/i18n/LocaleContext', () => ({
|
|
useLocale: () => ({ locale: 'de' }),
|
|
}));
|
|
|
|
vi.mock('@/guest/components/legal-markdown', () => ({
|
|
LegalMarkdown: () => <div>Legal markdown</div>,
|
|
}));
|
|
|
|
vi.mock('@tamagui/scroll-view', () => ({
|
|
ScrollView: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
|
}));
|
|
|
|
vi.mock('@tamagui/stacks', () => ({
|
|
YStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
|
XStack: ({ 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', () => ({
|
|
X: () => <span>x</span>,
|
|
}));
|
|
|
|
vi.mock('../components/SettingsContent', () => ({
|
|
default: () => <div>Settings content</div>,
|
|
}));
|
|
|
|
import SettingsSheet from '../components/SettingsSheet';
|
|
|
|
describe('SettingsSheet', () => {
|
|
it('renders settings content inside the sheet', () => {
|
|
render(<SettingsSheet open onOpenChange={vi.fn()} />);
|
|
|
|
expect(screen.getByText('Settings content')).toBeInTheDocument();
|
|
});
|
|
});
|