busterjs / buster

Abandoned - A powerful suite of automated test tools for JavaScript.
http://docs.busterjs.org
Other
448 stars 37 forks source link

busterjs/referee: isPromise #459

Closed mroderick closed 6 years ago

mroderick commented 9 years ago

Is there any interest in a PR adding isPromise to busterjs/referee?

dwittner commented 8 years ago

I am not sure. Do you think it is useful? Do you need it for testing?

dominykas commented 8 years ago

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?

dominykas commented 8 years ago

Just noticed that when calls this isPromiseLike and here's the check: https://github.com/cujojs/when/blob/ccd6970e55006abe73c110fe50eb315f3099bdf9/when.js#L161

mroderick commented 8 years ago

isPromiseLike would certainly work for the polyfilled scenarios.