import * as redux from "react-redux";
import store from "../../store";
import { Router } from "react-router-dom";
import { render, screen } from "@testing-library/react";
import history from "../../store/utils/history";
import ForgotPasswordConfirmationPage from "../../pages/ForgotPasswordPage/ForgotPasswordConfirmationPageMUI";

describe("ForgotPasswordConfirmationPage render tests", () => {
  const cont = (
    <redux.Provider store={store}>
      <Router history={history}>
        <ForgotPasswordConfirmationPage />
      </Router>
    </redux.Provider>
  );

  afterEach(() => {
    jest.restoreAllMocks();
  });

  it("Should render", () => {
    const { container } = render(cont);
    expect(
      container.getElementsByClassName("c-login-container")[0]
    ).toBeDefined();
  });

  it("Should render login logo", () => {
    const { container } = render(cont);
    expect(container.getElementsByClassName("login-logo")[0]).toBeDefined();
  });

  it("Should render header", () => {
    const { container } = render(cont);
    expect(
      container
        .getElementsByClassName("c-login-container")[0]
        .querySelector("h")
    ).toBeDefined();
  });

  it("Should render paragraph", () => {
    const { container } = render(cont);
    expect(
      container
        .getElementsByClassName("c-login-container")[0]
        .querySelector("p")
    ).toBeDefined();
  });

  it("Should link for  paragraph", () => {
    const { container } = render(cont);
    expect(
      container
        .getElementsByClassName("c-login-container")[0]
        .querySelector("p")
    ).toBeDefined();
  });

  it("Should render link for going to login page", () => {
    render(cont);
    expect(screen.getByTestId("back-link")).toBeDefined();
  });

  it("Should render dilig logo", () => {
    render(cont);
    expect(screen.getByTestId("dilig-logo")).toBeDefined();
  });
});
