jest.mock("../../Contexts/CANFiltersContext");
jest.mock("../../Contexts/StatusContext");
jest.mock("../../Contexts/UserContext");
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 { CANFiltersProvider } from "../../Contexts/CANFiltersContext";
import { StatusProvider } from "../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../Contexts/UserContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import MainForm from "./CarUpdatesTab"

const renderCarUpdatesTab = async () => {
  const { container } = render(
    <CANFiltersProvider>
      <StatusProvider>
        <UserProvider>
          <BrowserRouter>
            <MainForm vin="TESTVIN1234567890" />
          </BrowserRouter>
        </UserProvider>
      </StatusProvider>
    </CANFiltersProvider>
  );
  await waitFor(() => { });
  return container;
};

describe("CarUpdatesTab", () => {
  it("Render", async () => {
    setToken(TEST_AUTH_OBJECT);
    const container = await renderCarUpdatesTab();
    expect(container).toMatchSnapshot();
  });
});
