Merge branch 'codymikol-assertAsync-promiseLike-support'
- Merges #1613 from @codymikol - Fixes #1612
This commit is contained in:
@@ -261,7 +261,11 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isPromise = function(obj) {
|
||||
return typeof jasmineGlobal.Promise !== 'undefined' && obj && obj.constructor === jasmineGlobal.Promise;
|
||||
return typeof jasmineGlobal.Promise !== 'undefined' && !!obj && obj.constructor === jasmineGlobal.Promise;
|
||||
};
|
||||
|
||||
j$.isPromiseLike = function(obj) {
|
||||
return !!obj && j$.isFunction_(obj.then);
|
||||
};
|
||||
|
||||
j$.fnNameFor = function(func) {
|
||||
@@ -2160,7 +2164,7 @@ getJasmineRequireObj().AsyncExpectation = function(j$) {
|
||||
throw new Error('expectAsync is unavailable because the environment does not support promises.');
|
||||
}
|
||||
|
||||
if (!j$.isPromise(this.actual)) {
|
||||
if (!j$.isPromiseLike(this.actual)) {
|
||||
throw new Error('Expected expectAsync to be called with a promise.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user