import React from "react";
import { vi } from "vitest";
import { render } from "@testing-library/react";
import { Content } from "./index";
vi.mock("react-i18next", () => ({
    useTranslation: () => ({
        t: (key) => key,
    }),
}));
const { useNeighborhoodHighlightsMock } = vi.hoisted(() => ({
    useNeighborhoodHighlightsMock: vi.fn(),
}));
vi.mock("~/sdks/NeighborhoodHighlights/context", () => ({
    useNeighborhoodHighlights: useNeighborhoodHighlightsMock,
}));
vi.mock("~/components/TitleHeader", () => {
    return {
        TitleHeader: ({ title }) => (React.createElement("div", { "data-testid": "sdk-title", "data-value": title }, title)),
    };
});
vi.mock("../Highlights", () => {
    return {
        Highlights: () => React.createElement("div", { "data-testid": "highlights-component" }, "Highlights"),
    };
});
describe("Content", () => {
    afterEach(() => {
        vi.resetAllMocks();
    });
    it("passes the title from context to TitleHeader when title is a string", () => {
        useNeighborhoodHighlightsMock.mockReturnValue({ title: "Custom Title" });
        const { getByTestId } = render(React.createElement(Content, null));
        const titleElement = getByTestId("sdk-title");
        expect(titleElement).toHaveAttribute("data-value", "Custom Title");
    });
    it("passes the title from context to TitleHeader when title is false", () => {
        useNeighborhoodHighlightsMock.mockReturnValue({ title: false });
        const { getByTestId } = render(React.createElement(Content, null));
        const titleElement = getByTestId("sdk-title");
        expect(titleElement).toHaveAttribute("data-value", "false");
    });
    it("passes the default translation key to TitleHeader when title is undefined", () => {
        useNeighborhoodHighlightsMock.mockReturnValue({ title: undefined });
        const { getByTestId } = render(React.createElement(Content, null));
        const titleElement = getByTestId("sdk-title");
        expect(titleElement).toHaveAttribute("data-value", "title");
    });
    it("renders the Highlights component", () => {
        useNeighborhoodHighlightsMock.mockReturnValue({ title: "Custom Title" });
        const { getByTestId } = render(React.createElement(Content, null));
        const highlightsElement = getByTestId("highlights-component");
        expect(highlightsElement).toBeInTheDocument();
    });
});
//# sourceMappingURL=index.test.js.map