jest.mock("../../Contexts/CarUpdatesContext");

import React from "react";
import { render, waitFor } from "@testing-library/react";

import { CarUpdatesProvider } from "../../Contexts/CarUpdatesContext";
import CarUpdateStatusTable from "../CarUpdateStatusTable";
import { StatusProvider } from "../../Contexts/StatusContext";
import { TEST_AUTH_OBJECT } from "../../../utils/testing";
import addSnapshotSerializer from "../../../utils/snapshot";

const renderCarUpdateStatusTable = async () => {
  const { container } = render(
    <StatusProvider>
      <CarUpdatesProvider>
        <CarUpdateStatusTable carupdateid={283} token={TEST_AUTH_OBJECT} />
      </CarUpdatesProvider>
    </StatusProvider>
  );
  await waitFor(() => {});
  return container;
};

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

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