#edutomesco

1 messages · Page 1 of 1 (latest)

polar minnowBOT
crystal adder
#

Hi there, you can use Stripe CLI to trigger webhook events

slow fossil
#

but then it's mannually

#

I want to know if there is any tool to mock that triggers or something similar

crystal adder
#

Not sure what you mean by mock a trigger ?

slow fossil
#

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

crystal adder
#

Then it's not an e2e test, you are talking about unit test right?

slow fossil
#

yes

#

sorry for the confusion

crystal adder
#

So you might want to save some webhook event objects in you test cases, and use them to test the webhook handling logic

crystal adder
#
const mockedEventObject = { 
"id": "evt_ABC",
  "object": "event",
  "api_version": "2020-08-27",
  "created": 1668586067,
}

const result = yourFuctionThatHandlesEvent(mockedEventObject)
assertTrue(result, expected)

Something like this?

slow fossil
#

Nice!