hamjest
Version:
A library of composable matchers for defining meaningful and readable assertions in JavaScript.
24 lines (19 loc) • 556 B
JavaScript
;
const _ = require('lodash');
const Matcher = require('./Matcher');
function IsEqual(expectedValue) {
return _.create(new Matcher(), {
matches: function (actualValue) {
return _.isEqual(expectedValue, actualValue);
},
describeTo: function (description) {
description.appendValue(expectedValue);
},
getExpectedForDiff: function () { return expectedValue; },
formatActualForDiff: function (actual) { return actual; }
});
}
IsEqual.equalTo = function (operand) {
return new IsEqual(operand);
};
module.exports = IsEqual;