import { jsx, jsxs } from "react/jsx-runtime";
import React from "react";
import { render, fireEvent } from "@testing-library/react-native";
import { Star, MapPin } from "@gympass/yoga-icons";
import { ThemeProvider, Button, Icon } from "../../..";
import PlanCard from ".";
describe("<PlanCard />", () => {
  const buttonOnPressMock = jest.fn();
  const renderPlan = () => render(
    /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsxs(PlanCard, { children: [
      /* @__PURE__ */ jsx(PlanCard.Tag, { variant: "informative", children: "Recommended Plan" }),
      /* @__PURE__ */ jsxs(
        PlanCard.Content,
        {
          subtitle: "plan",
          title: "Basic",
          currency: "$",
          price: "99.90",
          period: "/month",
          children: [
            /* @__PURE__ */ jsx(PlanCard.Subtitle, { children: "Get access to" }),
            /* @__PURE__ */ jsxs(PlanCard.List, { children: [
              /* @__PURE__ */ jsx(
                PlanCard.ListItem,
                {
                  icon: /* @__PURE__ */ jsx(
                    Icon,
                    {
                      as: MapPin,
                      height: "small",
                      width: "small",
                      stroke: "medium"
                    }
                  ),
                  text: "gyms and studios"
                }
              ),
              /* @__PURE__ */ jsx(
                PlanCard.ListItem,
                {
                  icon: Star,
                  text: "list item",
                  buttonProps: {
                    children: "button",
                    onPress: buttonOnPressMock
                  }
                }
              )
            ] })
          ]
        }
      ),
      /* @__PURE__ */ jsx(PlanCard.Actions, { children: /* @__PURE__ */ jsx(Button, { full: true, children: "Select this plan" }) })
    ] }) })
  );
  describe("Events", () => {
    it("should call onPress when ListItem has a button", () => {
      const { getByText } = renderPlan();
      fireEvent.press(getByText("button"));
      expect(buttonOnPressMock).toHaveBeenCalled();
    });
  });
  describe("Snapshots", () => {
    it("should match snapshot with default PlanCard", () => {
      const { toJSON } = renderPlan();
      expect(toJSON()).toMatchSnapshot();
    });
    it("should match snapshot with variant", () => {
      const { toJSON } = render(
        /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(PlanCard, { variant: "hope", children: /* @__PURE__ */ jsx(
          PlanCard.Content,
          {
            subtitle: "plan",
            title: "Basic",
            currency: "$",
            price: "99.90",
            period: "/month"
          }
        ) }) })
      );
      expect(toJSON()).toMatchSnapshot();
    });
    it("should match snapshot with suffix", () => {
      const { toJSON } = render(
        /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(PlanCard, { variant: "hope", children: /* @__PURE__ */ jsx(
          PlanCard.Content,
          {
            subtitle: "plan",
            title: "Basic",
            currency: "$",
            suffix: "MXN",
            price: "99.90",
            period: "/month"
          }
        ) }) })
      );
      expect(toJSON()).toMatchSnapshot();
    });
  });
});
