Skip to content
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

Conversation

lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Jun 22, 2023

Resolves #1213 SDK-3554. See commit messages for more details.

@github-actions github-actions bot temporarily deployed to staging/pull/1349/features June 22, 2023 13:25 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1349/typedoc June 22, 2023 13:27 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1349/bundle-report June 22, 2023 13:27 Inactive
@lawrence-forooghian lawrence-forooghian marked this pull request as ready for review June 22, 2023 14:09
owenpearson and others added 24 commits June 27, 2023 16:11
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.
Copy link
Member

@owenpearson owenpearson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@lawrence-forooghian lawrence-forooghian merged commit b61e18b into integration/v2 Jul 3, 2023
@lawrence-forooghian lawrence-forooghian deleted the 1213-update-tests-to-use-promise-api branch July 3, 2023 12:04
@VeskeR VeskeR mentioned this pull request Mar 1, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants