Download src/test/utils.tsx from Jessedbrown/daisy-client: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/Jessedbrown/daisy-client/resolve/main/src/test/utils.tsx
- Command line
-
hf download hf://Jessedbrown/daisy-client/src/test/utils.tsx
-
curl -L -o utils.tsx https://huggingface.co/Jessedbrown/daisy-client/resolve/main/src/test/utils.tsx
685 Bytes
| import { render, RenderOptions } from '@testing-library/react'; | |
| import userEvent from '@testing-library/user-event'; | |
| import { ReactElement } from 'react'; | |
| import { BrowserRouter } from 'react-router-dom'; | |
| // Custom render function that includes providers | |
| function customRender( | |
| ui: ReactElement, | |
| options?: Omit<RenderOptions, 'wrapper'> | |
| ) { | |
| return render(ui, { | |
| wrapper: ({ children }) => <BrowserRouter>{children}</BrowserRouter>, | |
| ...options, | |
| }); | |
| } | |
| // Re-export everything from testing-library | |
| export * from '@testing-library/react'; | |
| // Override render method | |
| export { customRender as render }; | |
| // Setup user-event | |
| export const setupUser = () => userEvent.setup(); | |