"use strict";

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