Add custom async matchers

This commit is contained in:
Tony Brix
2019-07-08 15:13:06 -05:00
committed by Steve Gravrock
parent 008b80adc5
commit f77ee32c56
18 changed files with 876 additions and 49 deletions
+4 -1
View File
@@ -10,9 +10,12 @@ getJasmineRequireObj().toBeRejected = function(j$) {
* @example
* return expectAsync(aPromise).toBeRejected();
*/
return function toBeResolved(util) {
return function toBeRejected(util) {
return {
compare: function(actual) {
if (!j$.isPromiseLike(actual)) {
throw new Error('Expected toBeRejected to be called on a promise.');
}
return actual.then(
function() { return {pass: false}; },
function() { return {pass: true}; }