* CEC-1965 Supplier update and approval Fix calling connectedcars for no VINs Search sets table page to 0 * PR comments
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
jest.mock("../../Contexts/StatusContext");
|
|
jest.mock("../../Contexts/UserContext");
|
|
jest.mock("../../../services/suppliersAPI");
|
|
jest.mock("@material-ui/core/utils/unstable_useId", () =>
|
|
jest.fn().mockReturnValue("mui-test-id")
|
|
);
|
|
|
|
import { render, waitFor } from "@testing-library/react";
|
|
import { BrowserRouter } from "react-router-dom";
|
|
import { SupplierProvider } from "../../Contexts/SupplierContext";
|
|
import { StatusProvider } from "../../Contexts/StatusContext";
|
|
import { UserProvider, setToken } from "../../Contexts/UserContext";
|
|
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
|
|
import MainForm from "./index";
|
|
|
|
const renderSuppliersPage = async () => {
|
|
const { container } = render(
|
|
<SupplierProvider>
|
|
<StatusProvider>
|
|
<UserProvider>
|
|
<BrowserRouter>
|
|
<MainForm />
|
|
</BrowserRouter>
|
|
</UserProvider>
|
|
</StatusProvider>
|
|
</SupplierProvider>
|
|
);
|
|
await waitFor(() => {
|
|
/* render */
|
|
});
|
|
return container;
|
|
};
|
|
|
|
describe("Suppliers page", () => {
|
|
it("Render", async () => {
|
|
setToken(TEST_AUTH_OBJECT);
|
|
const container = await renderSuppliersPage();
|
|
expect(container).toMatchSnapshot();
|
|
});
|
|
});
|