#flyingace68

1 messages · Page 1 of 1 (latest)

devout oxideBOT
tawdry osprey
#

Hello, what about the mocking can we help you with?

fading shell
#

Well, I was looking at the UI testing docs and I didn't see anything there about how to create a jest.mock for that function so I can see if it has been called.

#

I want to be able to assert that when form data is entered correctly and the form is submitted that it is sent to Stripe.

#

Hello?

tawdry osprey
#

Sorry server was busy and I was still catching up. Was just getting back to this thread

fading shell
#

no worries

tawdry osprey
#

We actually recommend against automated filling out and submitting Stripe forms for testing. For those the type of mocking that we typically recommend is to get an example response from Stripe and have your code return that when it is time to mock submit details to Stripe.

fading shell
#

I don't want to actually submit data, I just want to be able to verify that if the form is filled out correctly and the user clicks "submit" that stripe.createToken is called.

tawdry osprey
#

Gotcha, I will consult my colleagues on this to see if there is another way to test what that test is getting at

#

For this you would want to not use stripe.js at all. You would want to define your own stripe.createToken method for your code to call during these mock tests and have jest track if that is called