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, screen } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import { ScorePoiList } from "./index";
const tMock = vi.fn((key, _options) => key);
vi.mock("react-i18next", (importOriginal) => __awaiter(void 0, void 0, void 0, function* () {
    return (Object.assign(Object.assign({}, (yield importOriginal())), { useTranslation: () => ({
            t: tMock,
        }) }));
}));
vi.mock("~/components/PoiIconDeprecated", () => ({
    PoiIcon: ({ type }) => React.createElement("div", null, type),
}));
const handleSelectPoiSubcategoryMock = vi.fn();
const availablePoiSubcategories = ["restaurants", "healthy_restaurants"];
const useLocalContentMock = vi.fn(() => ({
    selectedPoiSubcategory: null,
    availablePoiSubcategories,
    handleSelectPoiSubcategory: handleSelectPoiSubcategoryMock,
}));
vi.mock("~/sdks/LocalContent/context", () => ({
    useLocalContent: () => useLocalContentMock(),
}));
describe("ScorePoiList", () => {
    it("renders correctly", () => {
        useLocalContentMock.mockReturnValue({
            selectedPoiSubcategory: "restaurants",
            availablePoiSubcategories,
            handleSelectPoiSubcategory: vi.fn(),
        });
        render(React.createElement(ScorePoiList, { pois: {
                restaurants: [
                    {
                        name: "Pizza Place",
                        lat: 0,
                        lng: 0,
                        country: "CA",
                        proximity: { linear_distance: 0 },
                    },
                ],
                healthy_restaurants: [
                    {
                        name: "Healthy Eatery",
                        lat: 0,
                        lng: 0,
                        country: "CA",
                        proximity: { linear_distance: 0 },
                    },
                ],
            }, scoreKey: "restaurants", isLoading: false }));
        expect(screen.getByTestId("score-poi-list-subcategories-list")).toBeInTheDocument();
        expect(screen.getByTestId("score-poi-list-content")).toBeInTheDocument();
    });
    it("shows loading state", () => {
        render(React.createElement(ScorePoiList, { scoreKey: null, isLoading: true }));
        expect(screen.getByTestId("score-poi-list-loading")).toBeInTheDocument();
    });
    it("handles empty pois", () => {
        render(React.createElement(ScorePoiList, { scoreKey: null, isLoading: false, pois: {} }));
        expect(screen.queryByTestId("score-poi-list-content")).not.toBeInTheDocument();
    });
});
//# sourceMappingURL=index.test.js.map