I need to test my stripe webhook and also test against my d1 database after the webhook is ran which is not possible via vitest. I cannot use vitest-pool-workers because the endpoint will not be available to my local machine, only the internal testing environment. This is not possible
My question is that if there is a better way to setup my tests than the following (Resembles option #1 from the above link): - Create my tests and route them to the following endpoint
/test/...
/test/...
- Start dev server -
curl localhost:PORT/test/...
curl localhost:PORT/test/...
Example of test
// Use stripe api to create a customer and create an invoicestripeClient.createCustomer(...);...// Wait for the webhook to be called since stripe will receive the above event...// Check if the webhook successfully created a user in our backendconst user = db.getUser("...");// expect user to be defiend
// Use stripe api to create a customer and create an invoicestripeClient.createCustomer(...);...// Wait for the webhook to be called since stripe will receive the above event...// Check if the webhook successfully created a user in our backendconst user = db.getUser("...");// expect user to be defiend