import React from "react";
import { render } from "@testing-library/react-native";
import Badge from "./badge";
import { ThemeProvider } from "../../../theme/src/theme-context";
import Icon from "../../atoms/icon/icon";
import withBadge from "./withBadge";
jest.useFakeTimers();
describe("Molecules/Badge", () => {
  it("passes the snapshot test for different sizes", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Badge, {
      size: "xs"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      size: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      size: "m"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      size: "l"
    }, "2"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for different variants", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Badge, {
      variant: "rounded",
      mb: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      variant: "square",
      mb: "s"
    }, "NEW"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for different color schemes", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Badge, {
      colorScheme: "primary",
      mb: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      colorScheme: "success",
      mb: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      colorScheme: "warning",
      mb: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      colorScheme: "info",
      mb: "s"
    }, "2"), /*#__PURE__*/React.createElement(Badge, {
      colorScheme: "danger",
      mb: "s"
    }, "2"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test for different values types", () => {
    const tree = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Badge, null), /*#__PURE__*/React.createElement(Badge, null, "23"), /*#__PURE__*/React.createElement(Badge, null, 2, "+"), /*#__PURE__*/React.createElement(Badge, null, /*#__PURE__*/React.createElement(Icon, {
      iconFamily: "Entypo",
      iconName: "edit",
      color: "neutral.50",
      size: "s"
    })))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("withBadge HOC works as expected", () => {
    const Wrapper = () => {
      const BadgedIcon = withBadge(28, {
        placement: "topRight",
        size: "s"
      })(Icon);
      const BadgedIconTwo = withBadge( /*#__PURE__*/React.createElement(Icon, {
        iconFamily: "Ionicons",
        iconName: "pencil",
        size: "s",
        color: "white"
      }), {
        placement: "bottomRight",
        size: "m"
      })(Icon);
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BadgedIcon, {
        iconFamily: "FontAwesome",
        iconName: "inbox",
        size: "m",
        mb: "l"
      }), /*#__PURE__*/React.createElement(BadgedIconTwo, {
        iconFamily: "FontAwesome",
        iconName: "inbox",
        size: "m"
      }));
    };
    const root = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Wrapper, null)));
    const tree = root.toJSON();
    expect(tree).toMatchSnapshot();
    expect(root.getByText("28")).toBeTruthy();
  });
});
//# sourceMappingURL=badge.spec.js.map