"use strict";

var _react = _interopRequireDefault(require("react"));
var _screen = _interopRequireDefault(require("./screen"));
var _reactNative = require("@testing-library/react-native");
var _themeContext = require("../../../theme/src/theme-context");
var _box = _interopRequireDefault(require("../box/box"));
var _text = _interopRequireDefault(require("../text/text"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
jest.useFakeTimers();

// jest.mock("react-native-keyboard-aware-scroll-view", () => {
//   const KeyboardAwareScrollView = ({ children }: { children: any }) => children;
//   return { KeyboardAwareScrollView };
// });

jest.mock("react-native/Libraries/Utilities/Platform", () => {
  const platform = jest.requireActual("react-native/Libraries/Utilities/Platform");
  return {
    ...platform,
    constants: {
      ...platform.constants,
      reactNativeVersion: {
        major: 0,
        minor: 65,
        patch: 1
      }
    }
  };
});
describe("Atoms/Screen", () => {
  it("passes the snapshot test", () => {
    const tree = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_screen.default, null))).toJSON();
    expect(tree).toMatchSnapshot();
  });
  it("executes the function when pull-to-refresh is performed", async () => {
    const mockFn = jest.fn();
    const main = await (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_themeContext.ThemeProvider, null, /*#__PURE__*/_react.default.createElement(_screen.default, {
      onPullToRefresh: mockFn,
      testID: "scrollView"
    }, /*#__PURE__*/_react.default.createElement(_box.default, {
      w: 100,
      h: 200
    }, /*#__PURE__*/_react.default.createElement(_text.default, null, "Test")))));
    const scrollView = await main.getByTestId("scrollView");
    expect(scrollView).toBeDefined();
    const {
      refreshControl
    } = scrollView.props;
    await (0, _reactNative.act)(async () => {
      refreshControl.props.onRefresh();
    });
    expect(mockFn).toHaveBeenCalled();
  });
});
//# sourceMappingURL=screen.spec.js.map