jest.mock("../../../../Contexts/FleetContext");
jest.mock("../../../../Contexts/StatusContext");
jest.mock("../../../../Contexts/UserContext");

import { render, waitFor } from "@testing-library/react";
import { BrowserRouter } from "react-router-dom";

import { FleetProvider } from "../../../../Contexts/FleetContext";
import { StatusProvider } from "../../../../Contexts/StatusContext";
import { UserProvider, setToken } from "../../../../Contexts/UserContext";
import { TEST_AUTH_OBJECT_FISKER }from "../../../../../utils/testing";
import MainForm from "./index";
import addSnapshotSerializer from "../../../../../utils/snapshot";

const renderFleetCANFilterAdd = async () => {
  const { container } = render(
    <FleetProvider>
      <StatusProvider>
        <UserProvider>
          <BrowserRouter>
            <MainForm />
          </BrowserRouter>
        </UserProvider>
      </StatusProvider>
    </FleetProvider>
  );
  await waitFor(() => {});
  return container;
};

describe("FleetCANFilterAdd", () => {
  beforeAll(() => {
    addSnapshotSerializer(expect);
  });

  it("Render", async () => {
    setToken(TEST_AUTH_OBJECT_FISKER);
    const container = await renderFleetCANFilterAdd();
    expect(container).toMatchSnapshot();
  });
});
