I have installed react-router-domV6. I am having the above error when I run my very basic test using Jest-Enzyme:
expect(shallow(<CustomerListTable customers={mockCustomers} />).length).toEqual(1);
I already came across this similar issue mentioned here, but I am already doing the provided answers. Even tried doing the import { BrowserRouter as Router } from "react-router-dom";
. What am I missing here?
index.js
import React, { Suspense } from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { StrictMode } from "react";
import { BrowserRouter } from "react-router-dom";
...
ReactDOM.render(
<StrictMode>
...
<BrowserRouter>
<AuthProvider>
<App />
</AuthProvider>
</BrowserRouter>
...
</StrictMode>,
document.getElementById("root")
);
App.js
import React from "react";
import { useRoutes } from "react-router-dom";
import Routing from "./routes";
import useAuth from "./hooks/useAuth";
import { CreateCustomTheme } from "./theme";
import { ThemeProvider } from "@mui/material/styles";
import CssBaseline from "@mui/material/CssBaseline";
import useSettings from "./hooks/useSettings";
import useScrollReset from "./hooks/useScrollReset";
import SplashScreen from "./components/splashScreen/SplashScreen";
const App = () => {
const content = useRoutes(Routing());
const { settings } = useSettings();
const auth = useAuth();
useScrollReset();
const theme = CreateCustomTheme({
direction: settings.direction,
responsiveFontSizes: settings.responsiveFontSizes,
roundedCorners: settings.roundedCorners,
theme: settings.theme,
});
return (
<ThemeProvider theme={theme}>
<CssBaseline />
{auth.isInitialized ? content : <SplashScreen />}
</ThemeProvider>
);
};
export default App;