Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
D: function(spyInstance, args) {
var message = "";
for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
// describe multiple calls
if (l > 1) {
message += "\nCall " + (i + 1) + ":";
}
var calledArgs = spyInstance.getCall(i).args;
for (var j = 0; j < calledArgs.length || j < args.length; ++j) {
message += "\n";
var calledArgMessage = j < calledArgs.length ? sinonFormat(calledArgs[j]) : "";
if (match.isMatcher(args[j])) {
message += colorSinonMatchText(args[j], calledArgs[j], calledArgMessage);
} else {
var expectedArgMessage = j < args.length ? sinonFormat(args[j]) : "";
var diff = jsDiff.diffJson(calledArgMessage, expectedArgMessage);
message += colorDiffText(diff);
}
}
}
return message;
},
function getSymbols(object) {
if (samsam.isArguments(object)) {
return [];
}
/* istanbul ignore else */
if (typeof Object.getOwnPropertySymbols === "function") {
return Object.getOwnPropertySymbols(object);
}
/* istanbul ignore next: This is only for IE, since getOwnPropertySymbols
* does not exist on Object there
*/
return [];
}
function verifyMatcher(possibleMatcher, arg) {
var isMatcher = match.isMatcher(possibleMatcher);
return (isMatcher && possibleMatcher.test(arg)) || true;
}
calledOn: function calledOn(thisValue) {
if (match.isMatcher(thisValue)) {
return thisValue.test(this.thisValue);
}
return this.thisValue === thisValue;
},
match: function match(actual, expectation) {
var matcher = createMatcher(expectation);
if (matcher.test(actual)) {
assert.pass("match");
} else {
var formatted = [
"expected value to match",
" expected = " + format(expectation),
" actual = " + format(actual)
];
failAssertion(this, join(formatted, "\n"));
}
}
};
function(prev, expectation, i) {
var actual = self.args[i];
return prev && match(expectation).test(actual);
},
true
returned: function returned(value) {
return deepEqual(this.returnValue, value);
},
return every(arr1, function(element, i) {
return deepEqual(arr2[i], element);
});
}
function(prev, arg, i) {
return prev && deepEqual(self.args[i], arg);
},
true
function matches(fake, args, strict) {
var margs = fake.matchingArguments;
if (margs.length <= args.length && deepEqual(slice(args, 0, margs.length), margs)) {
return !strict || margs.length === args.length;
}
return false;
}