Throw an Error rather than a string when createSpyObj is called incorectly
This commit is contained in:
@@ -9964,7 +9964,9 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
}
|
||||
|
||||
if (methods.length === 0 && properties.length === 0) {
|
||||
throw 'createSpyObj requires a non-empty array or object of method names to create spies for';
|
||||
throw new Error(
|
||||
'createSpyObj requires a non-empty array or object of method names to create spies for'
|
||||
);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
@@ -153,7 +153,7 @@ describe('Spies', function() {
|
||||
it('should throw if you do not pass an array or object argument', function() {
|
||||
expect(function() {
|
||||
env.createSpyObj('BaseName');
|
||||
}).toThrow(
|
||||
}).toThrowError(
|
||||
'createSpyObj requires a non-empty array or object of method names to create spies for'
|
||||
);
|
||||
});
|
||||
@@ -161,7 +161,7 @@ describe('Spies', function() {
|
||||
it('should throw if you pass an empty array argument', function() {
|
||||
expect(function() {
|
||||
env.createSpyObj('BaseName', []);
|
||||
}).toThrow(
|
||||
}).toThrowError(
|
||||
'createSpyObj requires a non-empty array or object of method names to create spies for'
|
||||
);
|
||||
});
|
||||
@@ -169,7 +169,7 @@ describe('Spies', function() {
|
||||
it('should throw if you pass an empty object argument', function() {
|
||||
expect(function() {
|
||||
env.createSpyObj('BaseName', {});
|
||||
}).toThrow(
|
||||
}).toThrowError(
|
||||
'createSpyObj requires a non-empty array or object of method names to create spies for'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -54,7 +54,9 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
||||
}
|
||||
|
||||
if (methods.length === 0 && properties.length === 0) {
|
||||
throw 'createSpyObj requires a non-empty array or object of method names to create spies for';
|
||||
throw new Error(
|
||||
'createSpyObj requires a non-empty array or object of method names to create spies for'
|
||||
);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user