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

🍽 Downstream apps can't reliably test async listeners #338

Closed
4 of 9 tasks
tteltrab opened this issue Dec 11, 2019 · 4 comments
Closed
4 of 9 tasks

🍽 Downstream apps can't reliably test async listeners #338

tteltrab opened this issue Dec 11, 2019 · 4 comments
Labels
tests M-T: Testing work only

Comments

@tteltrab
Copy link
Contributor

Description

Trying to manage testing of a bolt app and running into some issues with reliably handling async - request handlers are resolving before messages have been handled. Wrote up a couple of test cases and opened a PR here to show them failing: #337

We have business logic in async handlers (pretty common pattern?) and ideally we'd be able to handle the response when it comes from that async pattern. Example PR shows three failing cases.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.
@tteltrab tteltrab changed the title 🍽 Downstream Apps Can't reliably test async listeners 🍽 Downstream apps can't reliably test async listeners Dec 11, 2019
@stevengill stevengill added the tests M-T: Testing work only label Dec 12, 2019
@stevengill
Copy link
Member

Thanks for the issue and PR @tteltrab. I'll bring this to the attention of a colleague.

@stevengill
Copy link
Member

@aoberoi Any chance you can check this one out when you have some spare cycles?

@aoberoi
Copy link
Contributor

aoberoi commented Dec 13, 2019

Left a comment in the PR linked above which outlines some approaches we could use to fix the issue.

@aoberoi aoberoi added the v1 label Jun 10, 2020
@aoberoi
Copy link
Contributor

aoberoi commented Jun 10, 2020

With the release of Bolt for JS v2, you can now test listeners more reliably.

We've demonstrated a pattern for this in Bolt's own tests, using the FakeReceiver class. Once you initialize an App with that receiver, you can call await fakeReceiver.sendEvent(somePayload) and the following line of code will execute after all the listeners have had a chance to process the event. No more arbitrary delays!

@aoberoi aoberoi closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests M-T: Testing work only
Projects
None yet
Development

No branches or pull requests

3 participants