Replies: 2 comments 2 replies
-
My happy path would be this:
The
People could still write their own tests using Jest or whatever. But for most applications, the In an ideal world, |
Beta Was this translation helpful? Give feedback.
-
one concern that comes to mind with recording the real webhooks and request payloads for me is focus. i purposely try to include as little content in those payloads in my tests in order to make it more clear which pieces actually have impact on the flow that i'm attempting to test. i fully agree that it can be difficult to grab a realistic example to reference, but personally i would rather make that piece easier and leave it up to the developer what to do with it. in some cases using the entire payload could be appropriate, but i mostly prefer not to use the full payload in actual tests. |
Beta Was this translation helpful? Give feedback.
-
Writing tests for Probot is hard. Usually you want to test what we call a webhook event lifecyle:
What we currently recommend is documented at https://probot.github.io/docs/testing/
What is hard is
nock
for the subsequent API requestsWhat I would like to do is to add a Probot feature that would record fixtures for both the webhook request coming from GItHub and the API requests into a fixtures folder, and then generate a test from that automatically. The test would be a "replay" of the previously recorded webhook event lifecycle. It would fail as soon as you change something in your code which result in different requests being sent from your app when receiving the same webhook.
If that happens, two things might have occurred
It's clear what to do for
1.
. What to do for2.
is less clear, it is something we need to consider. We should implement something like Jest's--updateSnapshot
option, which would mean that the fixtures for the API requests would be updated automatically.I am not sure how all this would work, I would be eager to here your thoughts.
Beta Was this translation helpful? Give feedback.
All reactions