Simplify test for arguments passed

This commit is contained in:
Nito Buendia
2022-03-16 21:26:59 +08:00
parent 2a5673e6ab
commit a7eff79db0
@@ -41,15 +41,13 @@ describe('toHaveSpyInteractions', function() {
}); });
}); });
[['argument'], [false, 0]].forEach(function(testValue) { it('throws error if arguments are passed', function() {
it(`throws error if arguments (${testValue}) are passed`, function() {
let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']); let spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['spyA', 'spyB']);
expect(function() { expect(function() {
expect(spyObj).toHaveSpyInteractions(...testValue); expect(spyObj).toHaveSpyInteractions('an argument');
}).toThrowError(Error, /Does not take arguments/); }).toThrowError(Error, /Does not take arguments/);
}); });
});
it('throws error if spy object has no spies', function() { it('throws error if spy object has no spies', function() {
const spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['method']); const spyObj = jasmineUnderTest.getEnv().createSpyObj('NewClass', ['method']);