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

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

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

  it("Render", async () => {
    const { container } = render(
      <DownloadFileLink data={"ABCDEFGHIJK"} filename="test.txt" />
    );
    await waitFor(() => {
      /* render */
    });
    expect(container).toMatchSnapshot();
  });
});
