"use strict";

var _react = _interopRequireDefault(require("react"));
var _pressable = _interopRequireDefault(require("./pressable"));
var _reactNative = require("@testing-library/react-native");
var _themeContext = require("../../../theme/src/theme-context");
var _interactions = require("moti/interactions");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.useFakeTimers();
describe("Atoms/Pressable", () => {
  it("passes the snapshot test for basic setup", async () => {
    const onPress = jest.fn();
    const tree = await (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_pressable.default, {
      onPress: onPress
    }, "Button press"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("passes the snapshot test when using style props", async () => {
    const onPress = jest.fn();
    const tree = await (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_pressable.default, {
      onPress: onPress,
      backgroundColor: "primary.500",
      borderColor: "neutral.400",
      borderWidth: 2
    }, "Button press"))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("captures the onPress event", async () => {
    const onPress = jest.fn();
    const component = await (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_interactions.MotiPressable, null, " "), /*#__PURE__*/_react.default.createElement(_pressable.default, {
      onPress: onPress,
      testID: "testOnPress"
    }, "Button press")));
    const tree = component.toJSON();
    if (tree.children[0].type !== "RNGestureHandlerButton") {
      const pressableInstance = component.getByTestId("testOnPress");
      _reactNative.fireEvent.press(pressableInstance);
      expect(onPress).toHaveBeenCalledTimes(1);
    }
  });
});
//# sourceMappingURL=pressable.spec.js.map