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

Provide an async waiting mechanism #500

Open
fargito opened this issue Jul 26, 2024 · 0 comments
Open

Provide an async waiting mechanism #500

fargito opened this issue Jul 26, 2024 · 0 comments

Comments

@fargito
Copy link
Owner

fargito commented Jul 26, 2024

Currently the way we check if events have been properly sent is quite basic:

  • we trigger the trail matching the required pattern
  • we execute some code to get the event to be sent
  • we wait an arbitrary amount of time
  • we retrieve the events from the trail
  • we assert with the content of the trail

This works, but is suboptimal, since increasing the wait time can lead to more reliable results, but on the same time increase our overall test duration. On the contrary, reducing the wait time can cause the tests to become flaky.

We should not have to manually wait at all.

The API could look something like:

await eventScoutClient.toContainEvents(
      // some assertions, for example
      expect.arrayContaining([
        expect.objectContaining({
          source,
          'detail-type': detailType,
          // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
          detail: expect.objectContaining({
            toto: 'tata',
            runId,
          }),
        }),
      ])
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant