{"size": 1046, "ext": "js", "max_stars_repo_path": "lib/mockStoreGetters.js", "max_stars_repo_name": "sarngru/vue-test-utils-helpers", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/mockStoreGetters.js", "max_issues_repo_name": "sarngru/vue-test-utils-helpers", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/mockStoreGetters.js", "max_forks_repo_name": "sarngru/vue-test-utils-helpers", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.7647058824, "max_line_length": 89, "alphanum_fraction": 0.6826003824}
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mockStoreGetters = mockStoreGetters;

function mockStoreGetters(_ref) {
  var modulesDictionary = _ref.modules,
      mockedGetters = _ref.mockedGetters,
      jestFn = _ref.jestFn;
  var gettersDictionary = {};
  Object.keys(modulesDictionary).forEach(function (moduleKey) {
    var moduleValue = modulesDictionary[moduleKey];
    var isNamespaced = Object.keys(moduleValue).includes('namespaced');

    if (moduleValue.getters) {
      Object.keys(moduleValue.getters).forEach(function (key) {
        var mockedGetterKey = isNamespaced ? "".concat(moduleKey, "/").concat(key) : key;
        var mockFn = jestFn(); // use custom mock functions when available

        if (Object.keys(mockedGetters).includes(mockedGetterKey)) {
          mockFn = mockedGetters[mockedGetterKey];
        }

        gettersDictionary[mockedGetterKey] = mockFn;
        moduleValue.getters[key] = mockFn;
      });
    }
  });
  return {
    getters: gettersDictionary
  };
}