"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;
var _react = _interopRequireDefault(require("react"));
var _mount = _interopRequireDefault(require("enzyme/mount"));
var _reactRedux = require("react-redux");
var _reduxMockStore = _interopRequireDefault(require("redux-mock-store"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var mockStore = (0, _reduxMockStore["default"])();

/**
 * Helper function to check the prop mappings in a connected component
 * It mounts the given component with the given state
 * @param Component
 * @param state
 * @param props
 * @returns {{store, wrapper: *}}
 */
function _default(Component) {
  var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  var store = mockStore(state);
  store.dispatch = jest.fn();
  var wrapper = (0, _mount["default"])( /*#__PURE__*/_react["default"].createElement(_reactRedux.Provider, {
    store: store
  }, /*#__PURE__*/_react["default"].createElement(Component, props)));
  return {
    store: store,
    wrapper: wrapper
  };
}