Include rejection details in failure messages for toBeResolved and toBeResolvedWith

[#178559119]
This commit is contained in:
Steve Gravrock
2021-06-21 16:43:51 -07:00
parent 163f93d6ff
commit 5862b22aef
6 changed files with 51 additions and 19 deletions
+10 -3
View File
@@ -15,12 +15,19 @@ describe('toBeResolved', function() {
it('fails if the actual is rejected', function() {
jasmine.getEnv().requirePromises();
var matchersUtil = new jasmineUnderTest.MatchersUtil(),
var matchersUtil = new jasmineUnderTest.MatchersUtil({
pp: jasmineUnderTest.makePrettyPrinter([])
}),
matcher = jasmineUnderTest.asyncMatchers.toBeResolved(matchersUtil),
actual = Promise.reject('AsyncExpectationSpec rejection');
actual = Promise.reject(new Error('AsyncExpectationSpec rejection'));
return matcher.compare(actual).then(function(result) {
expect(result).toEqual(jasmine.objectContaining({ pass: false }));
expect(result).toEqual({
pass: false,
message:
'Expected a promise to be resolved but it was rejected ' +
'with Error: AsyncExpectationSpec rejection.'
});
});
});