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 addSnapshotSerializer from "../../../utils/snapshot";
import { TEST_AUTH_OBJECT_FISKER } from "../../../utils/testing";
import { setToken } from "../../Contexts/UserContext";
import CANFiltersTab from "./CANFiltersTab";

const renderCANFiltersTab = async () => {
  const { container } = render(
    <BrowserRouter>
      <CANFiltersTab vin="TESTVIN1234567890" />
    </BrowserRouter>
  );
  await waitFor(() => {
    /* render */
  });
  return container;
};

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

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