import * as React from "react";

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

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

afterEach(cleanup);

const defaultProps = mock<ISubNavProps>();

describe("SubNav component rendering", () => {
	it("should render the component's wrapper", () => {
		render(
			<ThemeProvider theme={parseTheme(globalTheme)}>
				<SubNav {...defaultProps} />
			</ThemeProvider>,
		);

		const subNavWrapper = screen.getByTestId("sub-nav-wrapper");
		expect(subNavWrapper).toBeTruthy();
	});

	it("should render the component", () => {
		render(
			<ThemeProvider theme={parseTheme(globalTheme)}>
				<SubNav {...defaultProps} />
			</ThemeProvider>,
		);

		const subNav = screen.getByTestId("sub-nav");
		expect(subNav).toBeTruthy();
	});
});
