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 { describe, beforeEach, it, expect, vi } from "vitest";
import { renderHook, waitFor } from "@testing-library/react";
import { useLocation } from "./index";
const useLocationMock = vi.fn(() => ({
    isLoading: false,
    data: { country: "CAN", state: "" },
}));
vi.mock("./index", () => ({
    useLocation: () => useLocationMock(),
}));
describe("useLocation", () => {
    beforeEach(() => {
        vi.resetAllMocks();
    });
    it("should return the correct initial state", () => {
        const { result } = renderHook(() => useLocation({ lat: 0, lng: 0 }));
        expect(result.current.isLoading).toBe(false);
        expect(result.current.data).toEqual({ country: "CAN", state: "" });
    });
    it("should return location data correctly", () => __awaiter(void 0, void 0, void 0, function* () {
        useLocationMock.mockReturnValueOnce({
            isLoading: false,
            data: { country: "USA", state: "California" },
        });
        const { result } = renderHook(() => useLocation({ lat: 34.0522, lng: -118.2437 }));
        yield waitFor(() => expect(result.current.isLoading).toBe(false));
        expect(result.current.data).toEqual({
            country: "USA",
            state: "California",
        });
    }));
});
//# sourceMappingURL=index.test.js.map