16 lines
864 B
TypeScript
16 lines
864 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { ApiProblemError } from '../../src/apiClient';
|
|
import { RouteErrorBoundary } from '../../src/RouteErrorBoundary';
|
|
|
|
function BrokenRoute(): never { throw new ApiProblemError(500, { title: 'Fout' }, 'corr-route-7'); }
|
|
|
|
describe('RouteErrorBoundary', () => {
|
|
it('keeps the shell alive and exposes correlation context', () => {
|
|
render(<><nav aria-label="Applicatieshell">Navigatie</nav><RouteErrorBoundary resetKey="/broken"><BrokenRoute /></RouteErrorBoundary></>);
|
|
expect(screen.getByRole('navigation', { name: 'Applicatieshell' })).toBeInTheDocument();
|
|
expect(screen.getByRole('heading', { name: 'Deze pagina kon niet worden weergegeven' })).toBeInTheDocument();
|
|
expect(screen.getByText(/corr-route-7/)).toBeInTheDocument();
|
|
});
|
|
});
|