Enterprise-CMCS/macpro-mako

View on GitHub
react-app/src/utils/TestWrapper.tsx

Summary

Maintainability
A
0 mins
Test Coverage
C
75%
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createBrowserRouter, RouterProvider } from "react-router";

const queryClient = new QueryClient();

const router = (Element: any) =>
  createBrowserRouter([
    {
      path: "/",
      element: <Element />,
    },
  ]);

export const TestWrapper = ({ children }: any) => {
  return (
    <QueryClientProvider client={queryClient}>
      <RouterProvider router={router(children)} />
    </QueryClientProvider>
  );
};