import React from "react";
import { render } from "@testing-library/react";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { Header } from "./index";
vi.mock("@phosphor-icons/react", () => ({
    CaretUpIcon: ({ className }) => (React.createElement("svg", { className: className, "data-testid": "caret-up-icon" })),
}));
describe("Header", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("should render the Header component", () => {
        const mockOnClick = vi.fn();
        const { getByTestId } = render(React.createElement(Header, { onClick: mockOnClick }));
        const buttonElement = getByTestId("header-button");
        const iconElement = getByTestId("caret-up-icon");
        expect(buttonElement).toBeInTheDocument();
        expect(iconElement).toBeInTheDocument();
    });
    it("should call onClick when the button is clicked", () => {
        const mockOnClick = vi.fn();
        const { getByTestId } = render(React.createElement(Header, { onClick: mockOnClick }));
        const buttonElement = getByTestId("header-button");
        expect(buttonElement).toBeInTheDocument();
        expect(buttonElement.tagName).toBe("BUTTON");
        buttonElement.click();
        expect(mockOnClick).toHaveBeenCalledTimes(1);
    });
    it("should render without onClick", () => {
        const { getByTestId } = render(React.createElement(Header, null));
        const divElement = getByTestId("header-button");
        const iconElement = getByTestId("caret-up-icon");
        expect(divElement).toBeInTheDocument();
        expect(divElement.tagName).toBe("DIV");
        expect(iconElement).toBeInTheDocument();
    });
});
//# sourceMappingURL=index.test.js.map