-
Notifications
You must be signed in to change notification settings - Fork 56
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
Update the tests to use the Promise-based API #1349
Merged
lawrence-forooghian
merged 30 commits into
integration/v2
from
1213-update-tests-to-use-promise-api
Jul 3, 2023
Merged
Update the tests to use the Promise-based API #1349
lawrence-forooghian
merged 30 commits into
integration/v2
from
1213-update-tests-to-use-promise-api
Jul 3, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
Co-authored-by: Lawrence Forooghian <lawrence@forooghian.com>
…diately As part of #1213, I’ll be updating this test to use the Promise-based API, to which the concept of "calls the callback before returning" can’t be detected, since the JavaScript engine always calls Promise callbacks asynchronously.
…omise API When we switch to using the Promise-based API, we’ll need to wait for the result of `publish`, so let’s put the supporting code in place for that.
I’ve chosen to do this with the lightest touch possible — that is, maintaining the tests’ callback-based approach and simply bridging the SDK’s Promise-based API back to callbacks. I did this for the sake of reviewability and not accidentally changing the behaviour of the tests in some subtle way that I’d then have to put time into understanding. It would be good to, at some point, update the structure of the tests to use `async` / `await`, to improve readability and to make them reflect how the users actually interact with the Promise-based API in the real world. I’ve split out into the separate task #1348. Note that I haven’t made any changes to the calls to EventEmitter’s `once` or `whenState` methods — we’re going to keep the callback-based versions of those methods, since there is no Promise equivalent of being able to turn them off using `off`. Resolves #1213.
No longer needed as of 43a2d1d. I’ve kept the tests for EventEmitter (since, as mentioned in aforementioned commit, the main body of the tests uses the callback-based API), and also for init.test.js, which tests the result of `require('../../promises')`.
Thus replacing the (unused as of 6fe4914) callback versions.
49c4d92
to
d0f034e
Compare
owenpearson
approved these changes
Jul 3, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #1213 SDK-3554. See commit messages for more details.