busterjs/referee: isPromise
mroderick opened this issue · 4 comments
Is there any interest in a PR adding isPromise
to busterjs/referee
?
I am not sure. Do you think it is useful? Do you need it for testing?
I'm not sure this would even be a good practice, e.g. there's no explicit instanceof
assertion. Shouldn't you rather let the promise resolve/reject and check it that way?
Either way, what would the test for a promise be? There's a lot more to a promise than just then()
and it's fairly easy to assert that then
is a function. Is checking for anything more really possible, considering the plethora of promise libs and also the ES6 standard Promise?
Just noticed that when
calls this isPromiseLike
and here's the check: https://github.com/cujojs/when/blob/ccd6970e55006abe73c110fe50eb315f3099bdf9/when.js#L161
isPromiseLike
would certainly work for the polyfilled scenarios.