You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the first part of the Promises/A+ spec isn't tested:
A promise must be in one of three states: pending, fulfilled, or rejected.
When pending, a promise:
may transition to either the fulfilled or rejected state.
When fulfilled, a promise:
must not transition to any other state.
must have a fulfillment value, which must not change.
When rejected, a promise:
must not transition to any other state.
must have a rejection reason, which must not change.
I wrote a promise implementation which passed all tests, but failed to protect against incorrect state transitions. It should be fairly simple to write these tests given the existing adapter interface, I think.
I'd be willing to write these tests, I just wanted to run this by you first before I spend the time on creating a pull request.
The text was updated successfully, but these errors were encountered:
How do you plan to add these tests... I'm pretty sure we already test for multiple resolve and multiple reject calls. Of course a promise could offer an additional API method called mutate() which let you mutate the state after it was resolved, but I can't see how we could test for that.
@jnicklas Could you point us to a specific example, possibly from your implementation. For example, does your promise implementation allow an implementation-specific way of observing (perhaps via a public promise.state property?) a promise's state? As @ForbesLindesay says, we can only test against the then API, since that's the only specified way to observe a promise.
If you can show an example, though, that might help us understand if there's a hole in the spec and tests. Thanks!
@jnicklas If you can provide more info or examples here, we're happy to continue the discussion. If we haven't heard from you in two days, we'll consider this resolved or a non-issue. Thanks!
It seems like the first part of the Promises/A+ spec isn't tested:
I wrote a promise implementation which passed all tests, but failed to protect against incorrect state transitions. It should be fairly simple to write these tests given the existing adapter interface, I think.
I'd be willing to write these tests, I just wanted to run this by you first before I spend the time on creating a pull request.
The text was updated successfully, but these errors were encountered: