Add specs for the new toHaveSpyInteractions matcher

This commit is contained in:
Nito Buendia
2022-02-16 21:11:42 +08:00
parent 8e85f3df74
commit 7b01003d0b
2 changed files with 79 additions and 0 deletions

22
spec/core/integration/MatchersSpec.js Normal file → Executable file
View File

@@ -625,6 +625,28 @@ describe('Matchers (Integration)', function() {
});
});
describe('toHaveSpyInteractions', function() {
let spyObj;
beforeEach(function() {
spyObj = env.createSpyObj('NewClass', ['spyA', 'spyB']);
spyObj.otherMethod = function() {};
});
verifyPasses(function(env) {
spyObj.spyA();
env.expect(spyObj).toHaveSpyInteractions();
});
verifyFails(function(env) {
env.expect(spyObj).toHaveSpyInteractions();
});
verifyFails(function(env) {
spyObj.otherMethod();
env.expect(spyObj).toHaveSpyInteractions();
});
});
describe('toMatch', function() {
verifyPasses(function(env) {
env.expect('foo').toMatch(/oo$/);