Jacob Bolda
·
2025-07-07
utils.tsx
1import React, { type ReactElement } from "react";
2import { render, type RenderOptions } from "@testing-library/react";
3import { Provider } from "starfx/react";
4import { schema } from "../src/api";
5import { setupStore } from "../src/store";
6
7const AllTheProviders = ({ children }: { children: React.ReactNode }) => {
8 const store = setupStore({});
9 return (
10 <Provider schema={schema} store={store}>
11 {children}
12 </Provider>
13 );
14};
15
16const customRender = (
17 ui: ReactElement,
18 options?: Omit<RenderOptions, "wrapper">
19) => render(ui, { wrapper: AllTheProviders, ...options });
20
21// re-export everything
22export * from "@testing-library/react";
23
24// override render method
25export { customRender as render };