|
| 1 | +import { describe, it, expect, vi } from 'vitest'; |
| 2 | +import { render, screen } from '@testing-library/react'; |
| 3 | +import '@testing-library/jest-dom/vitest'; |
| 4 | +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; |
| 5 | +import { App } from '../App'; |
| 6 | + |
| 7 | +Element.prototype.scrollIntoView = vi.fn(); |
| 8 | + |
| 9 | +vi.mock('../native/mobileCommands', () => ({ |
| 10 | + signIn: vi.fn(), |
| 11 | + checkSession: vi.fn(), |
| 12 | + clearSession: vi.fn(), |
| 13 | + testAlert: vi.fn(), |
| 14 | +})); |
| 15 | + |
| 16 | +vi.mock('../native/hubHealth', () => ({ |
| 17 | + checkHubHealth: vi.fn(() => Promise.resolve({ reachable: true })), |
| 18 | +})); |
| 19 | + |
| 20 | +function renderWithProviders(ui: React.ReactElement) { |
| 21 | + const queryClient = new QueryClient({ |
| 22 | + defaultOptions: { queries: { retry: false } }, |
| 23 | + }); |
| 24 | + return render( |
| 25 | + <QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, |
| 26 | + ); |
| 27 | +} |
| 28 | + |
| 29 | +describe('Mobile App', () => { |
| 30 | + it('renders the bottom navigation bar', () => { |
| 31 | + renderWithProviders(<App />); |
| 32 | + expect(screen.getByText('Threads')).toBeInTheDocument(); |
| 33 | + }); |
| 34 | + |
| 35 | + it('starts on the threads view', () => { |
| 36 | + renderWithProviders(<App />); |
| 37 | + expect(screen.getByText('Threads')).toBeInTheDocument(); |
| 38 | + }); |
| 39 | +}); |
0 commit comments