import * as React from "react";
import { ThemeProvider } from "styled-components";
import { render, cleanup, screen } from "@testing-library/react";
import "@testing-library/jest-dom";

import { parseTheme } from "@ax/helpers";
import ProgressBar, { IProgressBarProps } from "@ax/components/ProgressBar";
import globalTheme from "@ax/themes/theme.json";

afterEach(cleanup);

describe("ProgressBar component rendering", () => {
	it("should render the component", () => {
		const defaultProps: IProgressBarProps = {
			percentage: 0,
		};

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

		const tracker = screen.getByTestId("progressbar-tracker");
		expect(tracker).toBeTruthy();
	});
});
