import * as React from "react";

import { ThemeProvider } from "styled-components";
import { mock } from "jest-mock-extended";
import { render, cleanup, screen } from "@testing-library/react";
import { parseTheme } from "@ax/helpers";
import "@testing-library/jest-dom";

import GuardModal, { IGuardModalProps } from "@ax/components/GuardModal";
import globalTheme from "@ax/themes/theme.json";

afterEach(cleanup);

const defaultProps = mock<IGuardModalProps>();

describe("GuardModal component rendering", () => {
	it("should render the component", () => {
		defaultProps.isOpen = true;

		render(
			<ThemeProvider theme={parseTheme(globalTheme)}>
				<GuardModal {...defaultProps} />
			</ThemeProvider>,
		);

		const guardModal = screen.getByTestId("modal-wrapper");
		expect(guardModal).toBeTruthy();
		const guardModalContent = screen.getByTestId("guard-modal-content");
		expect(guardModalContent).toBeTruthy();
	});
});
