Pull async matchers out to their own functions

- Makes AsyncExpectation closer to Expectation
This commit is contained in:
Gregg Van Hove
2018-10-23 16:02:31 -07:00
parent ba1e8f8008
commit 1e47dcf2cc
15 changed files with 566 additions and 617 deletions

View File

@@ -0,0 +1,22 @@
getJasmineRequireObj().toBeResolved = function(j$) {
/**
* Expect a promise to be resolved.
* @function
* @async
* @name async-matchers#toBeResolved
* @example
* await expectAsync(aPromise).toBeResolved();
* @example
* return expectAsync(aPromise).toBeResolved();
*/
return function toBeResolved(util) {
return {
compare: function(actual) {
return actual.then(
function() { return {pass: true}; },
function() { return {pass: false}; }
);
}
};
};
};