{"size": 2795, "ext": "js", "max_stars_repo_path": "node_modules/redux-form/lib/structure/immutable/__tests__/expectations.js", "max_stars_repo_name": "shantanupatwardhan7/react-redux-routing-", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/redux-form/lib/structure/immutable/__tests__/expectations.js", "max_issues_repo_name": "shantanupatwardhan7/react-redux-routing-", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/redux-form/lib/structure/immutable/__tests__/expectations.js", "max_forks_repo_name": "shantanupatwardhan7/react-redux-routing-", "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": 34.5061728395, "max_line_length": 274, "alphanum_fraction": 0.6382826476}
"use strict";

exports.__esModule = true;
exports.default = void 0;

var _deepEqual = _interopRequireDefault(require("deep-equal"));

var _immutable = require("immutable");

var _jestMatcherUtils = require("jest-matcher-utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var deepEqualValues = function deepEqualValues(a, b) {
  if (_immutable.Iterable.isIterable(a)) {
    return _immutable.Iterable.isIterable(b) && a.count() === b.count() && a.every(function (value, key) {
      return deepEqualValues(value, b.get(key));
    });
  }

  return (0, _deepEqual.default)(a, b); // neither are immutable collections
};

var api = {
  toBeAMap: function toBeAMap(actual) {
    var pass = _immutable.Map.isMap(actual);

    return {
      pass: pass,
      message: function message() {
        return "toBeAMap expected " + actual + " to be an immutable Map";
      }
    };
  },
  toBeAList: function toBeAList(actual) {
    var pass = _immutable.List.isList(actual);

    return {
      pass: pass,
      message: function message() {
        return "toBeAList expected " + actual + " to be an immutable List";
      }
    };
  },
  toBeSize: function toBeSize(actual, size) {
    var pass = _immutable.Iterable.isIterable(actual) && actual.count() === size;
    return {
      pass: pass,
      message: function message() {
        return "toBeSize expected " + actual + " to contain " + size + " elements";
      }
    };
  },
  toEqualMap: function toEqualMap(actual, expected) {
    var pass = deepEqualValues(actual, (0, _immutable.fromJS)(expected));
    return {
      pass: pass,
      message: function message() {
        return (0, _jestMatcherUtils.matcherHint)('.toEqualMap') + '\n\n' + "Expected value to equal map:\n" + ("  " + (0, _jestMatcherUtils.printExpected)((0, _immutable.fromJS)(expected)) + "\n") + "Received:\n" + ("  " + (0, _jestMatcherUtils.printReceived)(actual));
      }
    };
  },
  toContainExactly: function toContainExactly(actual, expected) {
    var expectedItems = expected.map(function (expectedItem) {
      return (0, _immutable.fromJS)(expectedItem);
    });
    var pass = actual.count() === expected.length && actual.every(function (actualItem) {
      return expectedItems.some(function (expectedItem) {
        return deepEqualValues(actualItem, expectedItem);
      });
    });
    return {
      pass: pass,
      message: function message() {
        return (0, _jestMatcherUtils.matcherHint)('.toContainExactly') + '\n\n' + "Expected value to contain:\n" + ("  " + (0, _jestMatcherUtils.printExpected)((0, _immutable.fromJS)(expected)) + "\n") + "Received:\n" + ("  " + (0, _jestMatcherUtils.printReceived)(actual));
      }
    };
  }
};
var _default = api;
exports.default = _default;