Closed briancavalier closed 12 years ago
I think this is covered by
https://github.com/domenic/promise-tests/blob/master/lib/promises-a.js#L284-338
right?
Hmmm, they do seem different, although I'm still not convinced that my example actually tests something useful :)
The existing tests ensure that all the immediate handlers of promise
receive the same value, and a handler cannot affect the promise resolution state, or the value seen by any of its peer handlers. I was hoping to try ensure that each immediate handler of promise
can return a different value (or take a different action, e.g. throw), and that each will be propagated downstream correctly to the next handler in the corresponding fork of the promise chain. In other words, the promise chain can diverge.
Is this kind of test valuable? I could imagine expanding it to cover cases like one fulfillment handler returning successfully, while another throws--ensuring that the subsequent steps in the chain are fulfilled and rejected.
Also, I use the
.then(done, done)
pattern in when.js's test because it tends to allow the test framework (buster.js in my case, but seems to work here, too) to report the real error rather than a timeout. That may provide better feedback for failures, but I'm not as familiar with async testing in mocha.