Match messages exactly in toHaveNoOtherSpyInteractions specs
This commit is contained in:
@@ -40,8 +40,10 @@ describe('toHaveNoOtherSpyInteractions', function() {
|
|||||||
|
|
||||||
let result = matcher.compare(spyObj);
|
let result = matcher.compare(spyObj);
|
||||||
expect(result.pass).toBeFalse();
|
expect(result.pass).toBeFalse();
|
||||||
expect(result.message).toContain(
|
// TODO: trim trailing newlines
|
||||||
'Expected to have no other spy interactions, but it had the following calls:'
|
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"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,10 +62,12 @@ describe('toHaveNoOtherSpyInteractions', function() {
|
|||||||
spyObj.spyB();
|
spyObj.spyB();
|
||||||
|
|
||||||
let result = matcher.compare(spyObj);
|
let result = matcher.compare(spyObj);
|
||||||
expect(result.pass).toBeFalse(),
|
expect(result.pass).toBeFalse();
|
||||||
expect(result.message).toContain(
|
expect(result.message).toEqual(
|
||||||
'Expected to have no other spy interactions, but it had the following calls:'
|
'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'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('passes when only non-observed spy object interactions are interacted', function() {
|
it('passes when only non-observed spy object interactions are interacted', function() {
|
||||||
@@ -77,8 +81,8 @@ describe('toHaveNoOtherSpyInteractions', function() {
|
|||||||
|
|
||||||
let result = matcher.compare(spyObj);
|
let result = matcher.compare(spyObj);
|
||||||
expect(result.pass).toBeTrue();
|
expect(result.pass).toBeTrue();
|
||||||
expect(result.message).toContain(
|
expect(result.message).toEqual(
|
||||||
"Expected to have other spy interactions but it didn't"
|
"Expected to have other spy interactions but it didn't."
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user