mirror of
https://git.um-react.app/um/um-react.git
synced 2026-10-21 14:03:01 +00:00
- Updated Node version in Dockerfile and .npmrc. - Upgraded various dependencies in package.json, including react-dropzone, react-router, and eslint. - Added pnpm-workspace.yaml for workspace management. - Adjusted TypeScript configurations and test utilities for compatibility. - Enhanced documentation for installation instructions and TypeScript toolchain.
26 lines
895 B
TypeScript
26 lines
895 B
TypeScript
import { RenderOptions, render } from '@testing-library/react';
|
|
import { PropsWithChildren } from 'react';
|
|
import { Provider } from 'react-redux';
|
|
import { AppStore, RootState, setupStore } from '~/store';
|
|
|
|
// Adapted from: https://redux.js.org/usage/writing-tests
|
|
|
|
// eslint-disable-next-line react-refresh/only-export-components
|
|
export * from '@testing-library/react';
|
|
|
|
export interface ExtendedRenderOptions extends RenderOptions {
|
|
preloadedState?: Partial<RootState>;
|
|
store?: AppStore;
|
|
}
|
|
|
|
export function renderWithProviders(
|
|
ui: React.ReactElement,
|
|
{ preloadedState = {}, store = setupStore(preloadedState), ...renderOptions }: ExtendedRenderOptions = {},
|
|
) {
|
|
function Wrapper({ children }: PropsWithChildren<unknown>): React.JSX.Element {
|
|
return <Provider store={store}>{children}</Provider>;
|
|
}
|
|
|
|
return { store, ...render(ui, { wrapper: Wrapper, ...renderOptions }) };
|
|
}
|