parent
0b7a1a90a1
commit
75a7dc8cdf
@ -1,13 +1,13 @@
|
||||
import { render } from "@testing-library/react";
|
||||
import { render } from "@/tests";
|
||||
import { StrictMode } from "react";
|
||||
import { describe, it } from "vitest";
|
||||
import { Main } from "../src/main";
|
||||
import App from ".";
|
||||
|
||||
describe("App", () => {
|
||||
it("should render without crash", () => {
|
||||
render(
|
||||
<StrictMode>
|
||||
<Main />
|
||||
<App />
|
||||
</StrictMode>
|
||||
);
|
||||
});
|
@ -1,10 +1,20 @@
|
||||
import { StrictMode } from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { Main } from "./main";
|
||||
import { useRoutes } from "react-router-dom";
|
||||
import { AllProviders } from "./providers";
|
||||
import { useRouteItems } from "./Router";
|
||||
|
||||
const RouteApp = () => {
|
||||
const items = useRouteItems();
|
||||
|
||||
return useRoutes(items);
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
<StrictMode>
|
||||
<Main />
|
||||
<AllProviders>
|
||||
<RouteApp />
|
||||
</AllProviders>
|
||||
</StrictMode>,
|
||||
document.getElementById("root")
|
||||
);
|
||||
|
@ -0,0 +1,13 @@
|
||||
import { AllProviders } from "@/providers";
|
||||
import { render, RenderOptions } from "@testing-library/react";
|
||||
import { ReactElement } from "react";
|
||||
|
||||
const customRender = (
|
||||
ui: ReactElement,
|
||||
options?: Omit<RenderOptions, "wrapper">
|
||||
) => render(ui, { wrapper: AllProviders, ...options });
|
||||
|
||||
// re-export everything
|
||||
export * from "@testing-library/react";
|
||||
// override render method
|
||||
export { customRender as render };
|
Loading…
Reference in new issue