Files
TREK/client/tests/helpers/render.tsx
T
Maurice 404981505c Resolve the remaining client type errors and the trip.title navbar bug
Drive the client typecheck to zero without any/ts-ignore: convert the tripId route param to a number once at the page boundary so it matches the numeric props and store actions it feeds, fix trip.name -> trip.title (the wire field is title, so the old read rendered blank in the files/offline views), and tighten the scattered handler-arity, DOM-cast and untyped-payload sites. No runtime behaviour change.
2026-05-31 18:29:23 +02:00

27 lines
883 B
TypeScript

import React from 'react';
import { render, type RenderOptions } from '@testing-library/react';
import { MemoryRouter, type MemoryRouterProps } from 'react-router-dom';
import { TranslationProvider } from '../../src/i18n/TranslationContext';
interface RenderWithProvidersOptions extends Omit<RenderOptions, 'wrapper'> {
initialEntries?: MemoryRouterProps['initialEntries'];
}
function renderWithProviders(
ui: React.ReactElement,
{ initialEntries = ['/'], ...options }: RenderWithProvidersOptions = {},
) {
function Wrapper({ children }: { children: React.ReactNode }) {
return (
<MemoryRouter initialEntries={initialEntries}>
<TranslationProvider>{children}</TranslationProvider>
</MemoryRouter>
);
}
return render(ui, { wrapper: Wrapper, ...options });
}
export * from '@testing-library/react';
export { renderWithProviders as render };