-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about the tests #52
Comments
Indeed, that is only testing
It's not testing that if a promise is fulfilled, then it must be fulfilled. It's testing that if a promise is fulfilled, it must not also be rejected. You are probably looking for the tests for 2.2.2.1: If onFulfilled is a function, it must be called after promise is fulfilled, with promise’s value as its first argument. |
Understood: the timeout is actually there to give the test time to fail when rejected async. But the assertion in Just trying to understand how the spec section maps to the assertion, |
After thinking about it a bit more what i am able to read out of this assertion and the logic in the helpers is:
is this what the call to |
Yes, that's it exactly :) |
I thought a lot about those tests now, while implementing them in ActionScript. (If this is not the case when you execute the JS-tests please tell me how they fail.) I think all this is caused by the fact that in the case where the test works no assertion is done at all. Does this make any sense for you or do I still don't get the scope of those tests? By the way: Is there a section 1.X anywhere? |
Oh, maybe there is one "invisible" assertion in your JS test framework: |
Yes, indeed! A timeout error will fail the test if 200 ms go by without |
Now a lot of things make more sense :-) Could you please also respond to my questions from my post before the last one? Thx |
I wouldn't add assertions that aren't there. The scope of the 2.1.2.1 tests is to test 2.1.2.1, not to test 2.2.2.1.
Section 1 is at http://promisesaplus.com/#terminology; it does not have tests. |
Ok, now I refactored how my tests wok so it matches the 200ms timeout per default and ails for that. I think what irritated me at the first point (beside the implicit fail) was that I normally write tests in a more TDD like fashion, so i first see them break and them make them work. Which was not possible the way i implemented those tests before today. Together with the fact that you can not really "prove" that something will not happen (e.g. by waiting 150 ms), this irritated me a lot. And so starting with those strange promise-state tests not knowing "the big picture" of the test suite, brought up all those question marks. My AS-Port of the test suite currently has 21 tests with finishing section
I will leave this issue open for the time I'm working on this, so we can discuss further questions in one "thread". |
Yeah, the tests are not very good for TDDing; see #48. |
I have read that thread before but didn't get what it is all about. |
would the testsuite also fail when |
It would fail |
I expected somthing like this :) |
I actually refactored some stuff so that those things doesn't happen anymore when using the helper methods. |
When I do understand it correctly, the last two specs in tests/2.2.2.js will not fail when only the last |
Really exciting! I'll be sure to link to this in the readme. |
(Ooops, pressed the submit button earlier than intended.)
Yeah, that's true. Because they're not testing that
Right, exactly. The 2.2.6 tests. |
Is there actually a reason for that everything regarding rejection is called (on)rejected but for resolving there is onFulfilled vs. resolve? |
Resolve and fulfill are very different operations. See "States and Fates". |
- corrected comment on promiseHandler to match with usages - changed calling of done to timeout after async scenario as [suggested](promises-aplus/promises-tests#52 (comment)) by domenic
👍 |
is there a special reason why you are calling |
It generates a fulfilled promise with fulfillment value |
or leave dummy out in all the other cases where it is not relevant... |
I'm currently trying to understand the tests to port them for the ActionScript implementation (see CC-Archived/promise-as3#11).
When i look at the first section suite I'm recognizing that it is only asserted that the promise doesn't get rejected but i don't see an assertion that it was fulfilled.
Which i would expect like this
is this checked somewhere else or did i miss something in how the tests are executed?
The text was updated successfully, but these errors were encountered: