Files
web-ui/tests/helpers/renderWithRouter.tsx
Beatrice Dellacà 4fc3738adf
Some checks failed
continuous-integration/drone/push Build is failing
add unit tests
2026-02-24 11:33:37 +01:00

13 lines
409 B
TypeScript

import type { ReactElement } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { render } from '@testing-library/react';
type RenderWithRouterOptions = {
route?: string;
};
export function renderWithRouter(ui: ReactElement, options: RenderWithRouterOptions = {}) {
const { route = '/' } = options;
return render(<MemoryRouter initialEntries={[route]}>{ui}</MemoryRouter>);
}