import React from "react";
import { render } from "@testing-library/react";
import { describe, beforeEach, it, expect, vi } from "vitest";
import { Header } from "./index";
vi.mock("react-i18next", () => ({
    useTranslation: () => ({
        t: (key) => key,
    }),
}));
const onToggleIsOpenMock = vi.fn();
vi.mock("../context", () => ({
    useRootElement: () => ({
        onToggleIsOpen: onToggleIsOpenMock,
    }),
}));
vi.mock("@phosphor-icons/react", () => ({
    XIcon: ({ className }) => (React.createElement("svg", { className: className, "data-testid": "x-icon" })),
}));
describe("Header Component", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("renders the title correctly", () => {
        const { getByTestId } = render(React.createElement(Header, null));
        const title = getByTestId("commute-calculator-title");
        expect(title).toBeInTheDocument();
        expect(title).toHaveTextContent("commute.cta");
    });
    it("calls onToggleIsOpen when the close button is clicked", () => {
        const { getByTestId } = render(React.createElement(Header, null));
        const closeButton = getByTestId("commute-calculator-close-button");
        closeButton.click();
        expect(onToggleIsOpenMock).toHaveBeenCalled();
    });
});
//# sourceMappingURL=index.test.js.map