import React from "react";
import { render } from "@testing-library/react";
import { describe, it, expect, vi } from "vitest";
import { Link } from ".";
describe("Link", () => {
    it("renders nothing if url is not provided", () => {
        const { queryByTestId } = render(React.createElement(Link, null));
        expect(queryByTestId("poi-popup-link")).toBeNull();
    });
    it("renders a link with the provided URL", () => {
        const url = "https://example.com";
        const { getByTestId } = render(React.createElement(Link, { url: url }));
        const linkElement = getByTestId("poi-popup-link");
        expect(linkElement).toBeInTheDocument();
        expect(linkElement).toHaveAttribute("href", url);
        expect(linkElement).toHaveTextContent(url);
    });
    it("calls onClick handler when the link is clicked", () => {
        const url = "https://example.com";
        const handleClick = vi.fn();
        const { getByTestId } = render(React.createElement(Link, { url: url, onClick: handleClick }));
        const linkElement = getByTestId("poi-popup-link");
        linkElement.click();
        expect(handleClick).toHaveBeenCalledWith(url);
    });
});
//# sourceMappingURL=index.test.js.map