toHaveNoOtherSpyInteractions message tweaks

This commit is contained in:
Steve Gravrock
2025-01-20 11:31:47 -08:00
parent 7463fe511b
commit 2a7a157713
3 changed files with 14 additions and 15 deletions

View File

@@ -6774,7 +6774,7 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
if (result.pass) {
result.message =
"Expected to have other spy interactions but it didn't.";
"Expected a spy object to have other spy interactions but it didn't.";
} else {
const ppUnexpectedCalls = unexpectedCalls
.map(
@@ -6783,9 +6783,9 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
.join(',\n');
result.message =
'Expected to have no other spy interactions, but it had the following calls:\n' +
'Expected a spy object to have no other spy interactions, but it had the following calls:\n' +
ppUnexpectedCalls +
'.\n\n';
'.';
}
return result;

View File

@@ -40,10 +40,9 @@ describe('toHaveNoOtherSpyInteractions', function() {
let result = matcher.compare(spyObj);
expect(result.pass).toBeFalse();
// TODO: trim trailing newlines
expect(result.message).toEqual(
'Expected to have no other spy interactions, but it had the following calls:\n' +
" NewClass.spyA called with [ 'x' ].\n\n"
'Expected a spy object to have no other spy interactions, but it had the following calls:\n' +
" NewClass.spyA called with [ 'x' ]."
);
});
@@ -64,9 +63,9 @@ describe('toHaveNoOtherSpyInteractions', function() {
let result = matcher.compare(spyObj);
expect(result.pass).toBeFalse();
expect(result.message).toEqual(
'Expected to have no other spy interactions, but it had the following calls:\n' +
' NewClass.spyA called with [ ],\n' +
' NewClass.spyB called with [ ].\n\n'
'Expected a spy object to have no other spy interactions, but it had the following calls:\n' +
' NewClass.spyA called with [ ],\n' +
' NewClass.spyB called with [ ].'
);
});
@@ -82,7 +81,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
let result = matcher.compare(spyObj);
expect(result.pass).toBeTrue();
expect(result.message).toEqual(
"Expected to have other spy interactions but it didn't."
"Expected a spy object to have other spy interactions but it didn't."
);
});
@@ -106,7 +105,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
let spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['spyA', 'spyB']);
.createSpyObj('mySpyObj', ['spyA', 'spyB']);
expect(function() {
matcher.compare(spyObj, 'an argument');
@@ -117,7 +116,7 @@ describe('toHaveNoOtherSpyInteractions', function() {
let matcher = jasmineUnderTest.matchers.toHaveNoOtherSpyInteractions();
const spyObj = jasmineUnderTest
.getEnv()
.createSpyObj('NewClass', ['notSpy']);
.createSpyObj('mySpyObj', ['notSpy']);
// Removing spy since spy objects cannot be created without spies.
spyObj.notSpy = function() {};

View File

@@ -64,7 +64,7 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
if (result.pass) {
result.message =
"Expected to have other spy interactions but it didn't.";
"Expected a spy object to have other spy interactions but it didn't.";
} else {
const ppUnexpectedCalls = unexpectedCalls
.map(
@@ -73,9 +73,9 @@ getJasmineRequireObj().toHaveNoOtherSpyInteractions = function(j$) {
.join(',\n');
result.message =
'Expected to have no other spy interactions, but it had the following calls:\n' +
'Expected a spy object to have no other spy interactions, but it had the following calls:\n' +
ppUnexpectedCalls +
'.\n\n';
'.';
}
return result;