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

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

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

  it("Render", async () => {
    const { container } = render(
      <ViewResult result={{ result: "success", message: "message" }} />
    );
    await waitFor(() => {
      /* render */
    });
    expect(container).toMatchSnapshot();
  });
});
