#Samsara

1 messages · Page 1 of 1 (latest)

long forgeBOT
whole copper
#

I have a lot of hooks/contexts that are dependencies and I'm trying to wrap my head around how to test

grizzled osprey
#

You shouldn't automate any interaction with Stripe Elements. Instead you should mock those parts of the interaction eg using our test payment methods etc.

whole copper
grizzled osprey
#

That's different, and specifically for Stripe Apps, not payment integrations

whole copper
#

So would I be able to test various scenarios such as card failure to make sure we're displaying the right messages? Or test a successful payment to make sure we're calling the right functions?

grizzled osprey
#

It depends exactly what you're trying to test, but I mean to should manually wire up test flows to simulate those outcomes and trigger the appropriate handlers etc

whole copper
#

I see, using test cards and test PI's and test client secrets?

#

I'm really trying to test the submit handler and make sure all the props I pass to the contexts I mock result in the correct flows

grizzled osprey
#

It really depends on the specific cases what you need to use, but generally yes you might submit payment with test PMs attached behind the scenes, or you could skip the Stripe parts of the flow entirely and just trigger your event handlers based on mocked results (which you'd produce first with manual testing using test cards etc)

whole copper
#

Ah I see

#

Thanks! Is there a resource I can follow that shows what that would look like?

#

Or some resource for what the mocks look like from stripe's end?

grizzled osprey
#

Not really as this is highly variable for each integration