#edutomesco
1 messages · Page 1 of 1 (latest)
but then it's mannually
I want to know if there is any tool to mock that triggers or something similar
Not sure what you mean by mock a trigger ?
I mean I want to do a test on my code
if I use the terminal it's not a automatic process I need manually to trigger the webhook
Then it's not an e2e test, you are talking about unit test right?
No problem. there's a stripe-mock library (https://github.com/stripe/stripe-mock) for mocking API response, but it doesn't provide webhook event mocking.
So you might want to save some webhook event objects in you test cases, and use them to test the webhook handling logic
exactly how I can do this?
const mockedEventObject = {
"id": "evt_ABC",
"object": "event",
"api_version": "2020-08-27",
"created": 1668586067,
}
const result = yourFuctionThatHandlesEvent(mockedEventObject)
assertTrue(result, expected)
Something like this?
Nice!