Replace parameterized test with different expectations
This approach makes it hard to scale and goes against DRY and debuggability vs the previous approach which followed Python parameterized testing, but this was the recommendation of the Jasmine team to keep it consistent with other tests. Further tests here could be adding other types like Array, Map, WeakMap, Set, WeakSet...
This commit is contained in:
@@ -60,14 +60,20 @@ describe('toHaveSpyInteractions', function() {
|
||||
);
|
||||
});
|
||||
|
||||
[true, 123, 'string'].forEach(function(testValue) {
|
||||
it(`throws error if a non-object (${testValue}) is passed`, function() {
|
||||
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
|
||||
it(`throws error if a non-object is passed`, function() {
|
||||
let matcher = jasmineUnderTest.matchers.toHaveSpyInteractions();
|
||||
|
||||
expect(function() {
|
||||
matcher.compare(testValue);
|
||||
}).toThrowError(Error, /Expected a spy object, but got/);
|
||||
});
|
||||
expect(function() {
|
||||
matcher.compare(true);
|
||||
}).toThrowError(Error, /Expected a spy object, but got/);
|
||||
|
||||
expect(function () {
|
||||
matcher.compare(123);
|
||||
}).toThrowError(Error, /Expected a spy object, but got/);
|
||||
|
||||
expect(function () {
|
||||
matcher.compare('string');
|
||||
}).toThrowError(Error, /Expected a spy object, but got/);
|
||||
});
|
||||
|
||||
it('throws error if arguments are passed', function() {
|
||||
|
||||
Reference in New Issue
Block a user