Migrate guest v2 achievements and refresh share page
This commit is contained in:
@@ -12,8 +12,8 @@ vi.mock('@tamagui/text', () => ({
|
||||
}));
|
||||
|
||||
vi.mock('@tamagui/button', () => ({
|
||||
Button: ({ children, ...rest }: { children: React.ReactNode }) => (
|
||||
<button type="button" {...rest}>
|
||||
Button: ({ children, onPress, ...rest }: { children: React.ReactNode; onPress?: () => void }) => (
|
||||
<button type="button" onClick={onPress} {...rest}>
|
||||
{children}
|
||||
</button>
|
||||
),
|
||||
@@ -24,48 +24,53 @@ vi.mock('../components/AppShell', () => ({
|
||||
}));
|
||||
|
||||
vi.mock('../context/EventDataContext', () => ({
|
||||
useEventData: () => ({
|
||||
token: 'demo-token',
|
||||
event: { name: 'Demo Event', join_token: 'demo-token' },
|
||||
}),
|
||||
useEventData: () => ({ token: 'demo', event: { name: 'Demo Event' } }),
|
||||
}));
|
||||
|
||||
vi.mock('../hooks/usePollStats', () => ({
|
||||
usePollStats: () => ({
|
||||
stats: {
|
||||
onlineGuests: 12,
|
||||
tasksSolved: 0,
|
||||
guestCount: 40,
|
||||
likesCount: 120,
|
||||
latestPhotoAt: null,
|
||||
},
|
||||
}),
|
||||
usePollStats: () => ({ stats: { onlineGuests: 3 } }),
|
||||
}));
|
||||
|
||||
vi.mock('../services/eventLink', () => ({
|
||||
buildEventShareLink: () => 'https://example.test/e/demo',
|
||||
}));
|
||||
|
||||
vi.mock('../services/qrApi', () => ({
|
||||
fetchEventQrCode: () => Promise.resolve({ qr_code_data_url: 'data:image/png;base64,abc' }),
|
||||
fetchEventQrCode: () => Promise.resolve({ qr_code_data_url: '' }),
|
||||
}));
|
||||
|
||||
vi.mock('../lib/guestTheme', () => ({
|
||||
useGuestThemeVariant: () => ({ isDark: false }),
|
||||
}));
|
||||
|
||||
vi.mock('../lib/bento', () => ({
|
||||
getBentoSurfaceTokens: () => ({
|
||||
borderColor: '#eee',
|
||||
borderBottomColor: '#ddd',
|
||||
backgroundColor: '#fff',
|
||||
shadow: 'none',
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('../lib/toast', () => ({
|
||||
pushGuestToast: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/guest/i18n/useTranslation', () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, arg2?: Record<string, string | number> | string, arg3?: string) =>
|
||||
typeof arg2 === 'string' || arg2 === undefined ? (arg2 ?? arg3 ?? key) : (arg3 ?? key),
|
||||
t: (key: string, options?: unknown, fallback?: string) => {
|
||||
if (typeof fallback === 'string') return fallback;
|
||||
if (typeof options === 'string') return options;
|
||||
return key;
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@/hooks/use-appearance', () => ({
|
||||
useAppearance: () => ({ resolved: 'light' }),
|
||||
}));
|
||||
|
||||
import ShareScreen from '../screens/ShareScreen';
|
||||
|
||||
describe('ShareScreen', () => {
|
||||
it('shows guests online from stats', async () => {
|
||||
it('renders invite header', async () => {
|
||||
render(<ShareScreen />);
|
||||
|
||||
expect(await screen.findByText('12')).toBeInTheDocument();
|
||||
expect(screen.getByText('Guests joined')).toBeInTheDocument();
|
||||
expect(screen.getByText('Guests online')).toBeInTheDocument();
|
||||
expect(screen.getByAltText('Event QR code')).toBeInTheDocument();
|
||||
expect(await screen.findByText('Invite guests')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user