/* eslint-env jest */ import { act } from 'react'; import { createRoot, type Root } from 'react-dom/client'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; import NotFound from '../NotFound'; ( globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean } ).IS_REACT_ACT_ENVIRONMENT = true; let root: Root; let host: HTMLDivElement; beforeEach(() => { host = document.createElement('div'); document.body.appendChild(host); root = createRoot(host); }); afterEach(() => { act(() => root.unmount()); host.remove(); }); it('answers an unknown address with the way back to HQ', async () => { await act(async () => { root.render( HQ

} /> } />
); }); expect(host.textContent).toContain('This page does not exist'); expect(host.querySelector('a')?.getAttribute('href')).toBe('/hq'); });