Pull async matchers out to their own functions
- Makes AsyncExpectation closer to Expectation
This commit is contained in:
22
src/core/matchers/async/toBeResolved.js
Normal file
22
src/core/matchers/async/toBeResolved.js
Normal 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}; }
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user