toBeRejectedWithError can expect the error to be Error, not just a subtype

This commit is contained in:
Steve Gravrock
2019-09-06 14:17:52 -07:00
parent 5a219da848
commit 2d3ac38df8
3 changed files with 22 additions and 6 deletions

View File

@@ -294,15 +294,12 @@ describe('Matchers (Integration)', function() {
});
describe('toBeRejectedWithError', function() {
function MyCustomError() {}
MyCustomError.prototype = new Error();
verifyPassesAsync(function(env) {
return env.expectAsync(Promise.reject(new MyCustomError())).toBeRejectedWithError(MyCustomError);
return env.expectAsync(Promise.reject(new Error())).toBeRejectedWithError(Error);
});
verifyFailsAsync(function(env) {
return env.expectAsync(Promise.resolve()).toBeRejectedWithError(MyCustomError);
return env.expectAsync(Promise.resolve()).toBeRejectedWithError(Error);
});
});