import React from "react";
import { vi } from "vitest";
import { render } from "@testing-library/react";
import { Icon } from "./index";
vi.mock("@phosphor-icons/react", () => ({
    SpinnerGapIcon: () => React.createElement("div", { "data-testid": "spinner-icon" }),
}));
vi.mock("~/components/ScoreIcon", () => ({
    ScoreIcon: ({ score }) => (React.createElement("div", { "data-testid": "score-icon" }, score)),
}));
describe("Icon", () => {
    it("renders the spinner icon when loading", () => {
        const { getByTestId } = render(React.createElement(Icon, { isLoading: true }));
        const spinnerIcon = getByTestId("spinner-icon");
        expect(spinnerIcon).toBeInTheDocument();
    });
    it("renders the score icon when not loading and score is provided", () => {
        const { getByTestId } = render(React.createElement(Icon, { isLoading: false, score: "pedestrian_friendly" }));
        const scoreIcon = getByTestId("score-icon");
        expect(scoreIcon).toHaveTextContent("pedestrian_friendly");
    });
    it("does not render an icon when not loading and score is not provided", () => {
        const { queryByTestId } = render(React.createElement(Icon, { isLoading: false }));
        const spinnerIcon = queryByTestId("spinner-icon");
        const scoreIcon = queryByTestId("score-icon");
        expect(spinnerIcon).toBeNull();
        expect(scoreIcon).toBeNull();
    });
});
//# sourceMappingURL=index.test.js.map