import React from 'react'; import { fireEvent, render, screen } from '@testing-library/react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; // One error fallback everywhere: the same "Try again", a way back to the // inbox outside mail, and each app has a boundary of its own that keeps the // navigation on screen. vi.mock('@/components/layout/navigation-rail', () => ({ NavigationRail: ({ orientation }: { orientation?: string }) => , })); const { AppErrorBoundary } = await import('../app-error-boundary'); const { ErrorBoundary } = await import('../error-boundary'); const { EmailListErrorFallback, SidebarErrorFallback, SettingsErrorFallback } = await import('../error-fallbacks'); let broken = true; function Flaky() { if (broken) throw new Error('boom'); return
calendar works
; } beforeEach(() => { broken = true; vi.spyOn(console, 'error').mockImplementation(() => {}); }); afterEach(() => vi.restoreAllMocks()); describe('app error boundary', () => { it('shows the fallback next to the navigation and recovers on Try again', () => { render(