import { describe, it, expect, vi } from "vitest";
import { renderHook } from "@testing-library/react";
import { useMarkers } from "./index";
const usePoisMock = vi.fn(() => ({
    isLoading: false,
    data: {},
}));
vi.mock("~/features/clientLibrary/usePois", () => ({
    usePois: () => usePoisMock(),
}));
const useEnhancedPoisMock = vi.fn(() => ({
    isLoading: false,
    data: {},
}));
vi.mock("~/features/clientLibrary/useEnhancedPois", () => ({
    useEnhancedPois: () => useEnhancedPoisMock(),
}));
const useSchoolsMock = vi.fn(() => ({
    isLoading: false,
    data: {},
}));
vi.mock("~/features/clientLibrary/useSchools", () => ({
    useSchools: () => useSchoolsMock(),
}));
describe("useMarkers", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("should return loading state and data", () => {
        const { result } = renderHook(() => useMarkers({ lat: 0, lng: 0 }));
        expect(result.current.isLoading).toBe(false);
        expect(result.current.data).toEqual({});
    });
    it("should return pois data", () => {
        usePoisMock.mockReturnValueOnce({
            isLoading: false,
            data: {
                parks: [
                    {
                        name: "Test Park",
                        address: "address",
                        city: "city",
                        province: "province",
                        postalcode: "postalcode",
                        country: "country",
                        lat: 0,
                        lng: 0,
                        proximity: {
                            linear_distance: 0,
                            walking: undefined,
                        },
                    },
                ],
            },
        });
        const { result } = renderHook(() => useMarkers({ lat: 10, lng: 20, categoriesDeprecated: ["parks"] }));
        expect(result.current.data).toEqual({
            parks: [
                {
                    name: "Test Park",
                    address: "address",
                    city: "city",
                    province: "province",
                    postalcode: "postalcode",
                    country: "country",
                    lat: 0,
                    lng: 0,
                    proximity: {
                        linear_distance: 0,
                        walking: undefined,
                    },
                },
            ],
        });
    });
    it("should return schools data", () => {
        useSchoolsMock.mockReturnValueOnce({
            isLoading: false,
            data: {
                primary_schools: [
                    {
                        name: "Test School",
                        address: "address",
                        city: "city",
                        province: "province",
                        postalcode: "postalcode",
                        country: "country",
                        lat: 0,
                        lng: 0,
                        proximity: {
                            linear_distance: 0,
                            walking: undefined,
                        },
                    },
                ],
                high_schools: [],
            },
        });
        const { result } = renderHook(() => useMarkers({
            lat: 10,
            lng: 20,
            categoriesDeprecated: ["primary_schools"],
        }));
        expect(result.current.data).toEqual({
            primary_schools: [
                {
                    name: "Test School",
                    address: "address",
                    city: "city",
                    province: "province",
                    postalcode: "postalcode",
                    country: "country",
                    lat: 0,
                    lng: 0,
                    proximity: {
                        linear_distance: 0,
                        walking: undefined,
                    },
                },
            ],
        });
    });
    it("should handle loading state for pois and schools", () => {
        usePoisMock.mockReturnValueOnce({
            isLoading: true,
            data: {},
        });
        useSchoolsMock.mockReturnValueOnce({
            isLoading: false,
            data: {
                primary_schools: [],
                high_schools: [],
            },
        });
        const { result } = renderHook(() => useMarkers({ lat: 10, lng: 20, categoriesDeprecated: ["parks"] }));
        expect(result.current.isLoading).toBe(true);
        expect(result.current.data).toEqual({});
    });
    it("should return empty data when no categories are provided", () => {
        const { result } = renderHook(() => useMarkers({ lat: 10, lng: 20 }));
        expect(result.current.data).toEqual({});
    });
});
//# sourceMappingURL=index.test.js.map