function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import React from 'react';
import { Provider } from 'react-redux';
import { renderWithTheme } from '@looker/components-test-utils';
import { createStore } from '@looker/redux';
import { BrowserAdaptor, registerEnvAdaptor } from '@looker/extension-utils';
import { initRunItSdk } from '@looker/run-it';
import { settingsSlice, defaultLodesState, defaultSettingsState, lodesSlice, defaultSpecsState, specsSlice } from '../state';
import { specState } from '../test-data';
import { renderWithRouter } from './router';
export var withReduxProvider = function withReduxProvider(consumers) {
  var store = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createTestStore();
  registerEnvAdaptor(new BrowserAdaptor(initRunItSdk()));
  return React.createElement(Provider, {
    store: store
  }, consumers);
};
export var renderWithReduxProvider = (consumers, store, options) => renderWithTheme(withReduxProvider(consumers, store), options);
export var renderWithRouterAndReduxProvider = function renderWithRouterAndReduxProvider(consumers) {
  var initialEntries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['/'];
  var store = arguments.length > 2 ? arguments[2] : undefined;
  var options = arguments.length > 3 ? arguments[3] : undefined;
  return renderWithRouter(withReduxProvider(consumers, store), initialEntries, options);
};
export var preloadedState = {
  settings: defaultSettingsState,
  lodes: defaultLodesState,
  specs: defaultSpecsState
};
export var createTestStore = overrides => createStore({
  preloadedState: {
    settings: _objectSpread(_objectSpread({}, preloadedState.settings), overrides === null || overrides === void 0 ? void 0 : overrides.settings),
    lodes: _objectSpread(_objectSpread({}, defaultLodesState), overrides === null || overrides === void 0 ? void 0 : overrides.lodes),
    specs: _objectSpread(_objectSpread({}, specState), overrides === null || overrides === void 0 ? void 0 : overrides.specs)
  },
  reducer: {
    settings: settingsSlice.reducer,
    lodes: lodesSlice.reducer,
    specs: specsSlice.reducer
  }
});
//# sourceMappingURL=redux.js.map