substantial/sinon-stub-promise

Chaining promises don't work as intended

rhagigi opened this issue · 1 comments

I think I may have introduced this (partially) with #18 -- but it has more to do with how we store the thenable -- I think it was an issue before that too but I don't have time right now to test it out.

With the new change, chained promises don't work at all -- I simply call onFulfilled on every "then" -- even chained thens -- I need to make sure I store the returned value for chained thens. Even without it though, I'm not sure the following situation would have worked. I'll work up a fix (and include in it the changes to make withArgs() work -- I realized I never gave yall that PR. This will be related since we have to maintain the chain individually -- not simply tied to the stub

promise.then((value)=>return value2));
promise.then((value) => expect (value !== value2));

If you could add a test case, I could work on this at some point in the next couple of days. Thanks.