Updated toHaveBeenCalledOnceWith for new matcher interface

This commit is contained in:
Steve Gravrock
2020-06-26 15:14:02 -07:00
parent 13b967b59c
commit b3ab9fad9d
3 changed files with 14 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function (j$) {
* @example
* expect(mySpy).toHaveBeenCalledOnceWith('foo', 'bar', 2);
*/
function toHaveBeenCalledOnceWith(util, customEqualityTesters) {
function toHaveBeenCalledOnceWith(util) {
return {
compare: function () {
var args = Array.prototype.slice.call(arguments, 0),
@@ -26,7 +26,7 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function (j$) {
return ' ' + j$.pp(argsForCall);
});
if (actual.calls.count() === 1 && util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) {
if (actual.calls.count() === 1 && util.contains(actual.calls.allArgs(), expectedArgs)) {
return {
pass: true,
message: 'Expected spy ' + actual.and.identity + ' to have been called 0 times, multiple times, or once, but with arguments different from:\n'
@@ -39,7 +39,7 @@ getJasmineRequireObj().toHaveBeenCalledOnceWith = function (j$) {
function getDiffs() {
return actual.calls.allArgs().map(function (argsForCall, callIx) {
var diffBuilder = new j$.DiffBuilder();
util.equals(argsForCall, expectedArgs, customEqualityTesters, diffBuilder);
util.equals(argsForCall, expectedArgs, diffBuilder);
return diffBuilder.getMessage();
});
}