var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import React from "react";
import { render } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import { Summary } from ".";
const useNeighborhoodHeroMock = vi.fn();
vi.mock("react-i18next", (importOriginal) => __awaiter(void 0, void 0, void 0, function* () {
    return (Object.assign(Object.assign({}, (yield importOriginal())), { useTranslation: () => ({
            t: (key, { context } = {}) => typeof context !== "undefined" ? `${key}_${context}` : key,
        }) }));
}));
vi.mock("~/sdks/NeighborhoodHero/context", () => ({
    useNeighborhoodHero: () => useNeighborhoodHeroMock(),
}));
describe("Summary", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("does not render if there is no neighborhood summary", () => {
        useNeighborhoodHeroMock.mockReturnValue({
            neighborhoodSummary: null,
            geography: { level: 30 },
        });
        const { queryByTestId } = render(React.createElement(Summary, null));
        expect(queryByTestId("summary-container")).toBeNull();
    });
    it("renders the summary title when neighborhood summary is available", () => {
        useNeighborhoodHeroMock.mockReturnValue({
            neighborhoodSummary: "This is a summary.",
            geography: { level: 10 },
        });
        const { getByTestId } = render(React.createElement(Summary, null));
        expect(getByTestId("summary-title")).toHaveTextContent("summaryTitle");
    });
    it("renders the summary title with area context when geography level is 30 or above", () => {
        useNeighborhoodHeroMock.mockReturnValue({
            neighborhoodSummary: "This is a summary.",
            geography: { level: 30 },
        });
        const { getByTestId } = render(React.createElement(Summary, null));
        expect(getByTestId("summary-title")).toHaveTextContent("summaryTitle_area");
    });
    it("renders the neighborhood summary text", () => {
        useNeighborhoodHeroMock.mockReturnValue({
            neighborhoodSummary: "This is a summary.",
            geography: { level: 10 },
        });
        const { getByTestId } = render(React.createElement(Summary, null));
        expect(getByTestId("summary-description")).toHaveTextContent("This is a summary.");
    });
});
//# sourceMappingURL=index.test.js.map