-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improving Testability of Handlers v2 #111
Improving Testability of Handlers v2 #111
Conversation
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.
I love how this turned out! Can't wait to use it to actually test all these handlers with zero coverage!
Here are a few things I saw.
Co-Authored-By: Adam Zaninovich <adam.zaninovich@gmail.com>
Co-Authored-By: Adam Zaninovich <adam.zaninovich@gmail.com>
Co-Authored-By: Adam Zaninovich <adam.zaninovich@gmail.com>
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.
You might want to run the formatter, but other than that it looks good to me.
Ok, formatter has been run, ran credo while I was at it, and wrote a bunch of documentation for the new modules and methods. |
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 great!
❤️ |
Ok, here's v2 of the work to improve the testability of handlers. This extracts the Outbound functions of the chat backend into a behaviour, then implements that behavior into a SlackOutbound module. This allows us to create a Spy of this Behaviour to capture outbound replies. I've updated the internal tests of the handler helpers, and then added a few tests for some of the internal handlers to reflect the new style. I've also created some macros to make it easier for people to implement the most common flows in by using Alice.Handlers.Case.
I also updated alice_roller in a separate branch so you can see what tests look like in a third party handler as well: https://github.com/NateBarnes/alice_roller/blob/testing-refactor/test/alice/handlers/roller_test.exs
I believe this should resolve #47 . Let me know what y'all think though