Run Prettier on all files
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||
|
||||
var getErrorMsg = j$.formatErrorMsg('<toHaveBeenCalledWith>', 'expect(<spyObj>).toHaveBeenCalledWith(...arguments)');
|
||||
var getErrorMsg = j$.formatErrorMsg(
|
||||
'<toHaveBeenCalledWith>',
|
||||
'expect(<spyObj>).toHaveBeenCalledWith(...arguments)'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@link expect} the actual (a {@link Spy}) to have been called with particular arguments at least once.
|
||||
@@ -20,14 +22,23 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||
result = { pass: false };
|
||||
|
||||
if (!j$.isSpy(actual)) {
|
||||
throw new Error(getErrorMsg('Expected a spy, but got ' + matchersUtil.pp(actual) + '.'));
|
||||
throw new Error(
|
||||
getErrorMsg(
|
||||
'Expected a spy, but got ' + matchersUtil.pp(actual) + '.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (!actual.calls.any()) {
|
||||
result.message = function() {
|
||||
return 'Expected spy ' + actual.and.identity + ' to have been called with:\n' +
|
||||
' ' + matchersUtil.pp(expectedArgs) +
|
||||
'\nbut it was never called.';
|
||||
return (
|
||||
'Expected spy ' +
|
||||
actual.and.identity +
|
||||
' to have been called with:\n' +
|
||||
' ' +
|
||||
matchersUtil.pp(expectedArgs) +
|
||||
'\nbut it was never called.'
|
||||
);
|
||||
};
|
||||
return result;
|
||||
}
|
||||
@@ -35,28 +46,49 @@ getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
|
||||
if (matchersUtil.contains(actual.calls.allArgs(), expectedArgs)) {
|
||||
result.pass = true;
|
||||
result.message = function() {
|
||||
return 'Expected spy ' + actual.and.identity + ' not to have been called with:\n' +
|
||||
' ' + matchersUtil.pp(expectedArgs) +
|
||||
'\nbut it was.';
|
||||
return (
|
||||
'Expected spy ' +
|
||||
actual.and.identity +
|
||||
' not to have been called with:\n' +
|
||||
' ' +
|
||||
matchersUtil.pp(expectedArgs) +
|
||||
'\nbut it was.'
|
||||
);
|
||||
};
|
||||
} else {
|
||||
result.message = function() {
|
||||
var prettyPrintedCalls = actual.calls.allArgs().map(function(argsForCall) {
|
||||
return ' ' + matchersUtil.pp(argsForCall);
|
||||
});
|
||||
var prettyPrintedCalls = actual.calls
|
||||
.allArgs()
|
||||
.map(function(argsForCall) {
|
||||
return ' ' + matchersUtil.pp(argsForCall);
|
||||
});
|
||||
|
||||
var diffs = actual.calls.allArgs().map(function(argsForCall, callIx) {
|
||||
var diffBuilder = new j$.DiffBuilder();
|
||||
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
|
||||
return 'Call ' + callIx + ':\n' +
|
||||
diffBuilder.getMessage().replace(/^/mg, ' ');
|
||||
});
|
||||
var diffs = actual.calls
|
||||
.allArgs()
|
||||
.map(function(argsForCall, callIx) {
|
||||
var diffBuilder = new j$.DiffBuilder();
|
||||
matchersUtil.equals(argsForCall, expectedArgs, diffBuilder);
|
||||
return (
|
||||
'Call ' +
|
||||
callIx +
|
||||
':\n' +
|
||||
diffBuilder.getMessage().replace(/^/gm, ' ')
|
||||
);
|
||||
});
|
||||
|
||||
return 'Expected spy ' + actual.and.identity + ' to have been called with:\n' +
|
||||
' ' + matchersUtil.pp(expectedArgs) + '\n' + '' +
|
||||
return (
|
||||
'Expected spy ' +
|
||||
actual.and.identity +
|
||||
' to have been called with:\n' +
|
||||
' ' +
|
||||
matchersUtil.pp(expectedArgs) +
|
||||
'\n' +
|
||||
'' +
|
||||
'but actual calls were:\n' +
|
||||
prettyPrintedCalls.join(',\n') + '.\n\n' +
|
||||
diffs.join('\n');
|
||||
prettyPrintedCalls.join(',\n') +
|
||||
'.\n\n' +
|
||||
diffs.join('\n')
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user