import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";
import { TooltipProps } from "../TooltipProps";
import Tooltip from "../Tooltip";

describe("Tooltip Component", () => {
  const props: TooltipProps = {
    dataTestId: "test-id",
    anchorElement: "pointer",
    appendTo: document.body,
    children: null,
    className: "tooltip-class",
    content: () => "Tooltip content",
    id: "tooltip-id",
    open: false,
    openDelay: 0,
    parentTitle: false,
    position: "top",
    showCallout: true,
    style: { color: "black" },
    targetElement: null,
    tooltipClassName: "tooltip-dom-class",
    tooltipStyle: { fontSize: "12px" },
    updateInterval: 1000,
  };

  it("renders all props correctly", () => {
    render(<Tooltip {...props} />);
  });

  it("matches the snapshot", () => {
    const { asFragment } = render(<Tooltip {...props} />);
    expect(asFragment()).toMatchSnapshot();
  });
});
