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

import DownloadCerts from "./DownloadCerts";
import addSnapshotSerializer from "../../../utils/snapshot";

describe("DownloadCerts", () => {
  beforeAll(() => {
    global.URL.createObjectURL = jest.fn();
    global.URL.revokeObjectURL = jest.fn();
    addSnapshotSerializer(expect);
  });

  it("Render", async () => {
    const { container } = render(
      <DownloadCerts
        vin={"TESTVIN"}
        publicCert={"PUBLIC"}
        privateCert={"PRIVATE"}
      />
    );
    await waitFor(() => {
      /* render */
    });
    expect(container).toMatchSnapshot();
  });
});
