Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminshafii committed Dec 6, 2024
1 parent ed78d28 commit c09bd19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/scripts/webhooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,21 @@ describe("Stripe Webhook Tests", () => {
test("Failed Payment", async () => {
// Arrange
const userId = generateTestUserId("payment_failed");
const metadata = {
userId,
type: config.products.SubscriptionMonthly.metadata.type,
plan: config.products.SubscriptionMonthly.metadata.plan,
};
// complete a session first
triggerWebhook(`stripe trigger checkout.session.completed \
--add checkout_session:metadata.userId=${userId} \
--add checkout_session:metadata.type=${metadata.type} \
--add checkout_session:metadata.plan=${metadata.plan} \
--add checkout_session:mode=subscription`);

// Act
triggerWebhook(`stripe trigger invoice.payment_failed \
--add invoice:metadata.userId=${userId} \
--add invoice:metadata.type=subscription \
--add invoice:status=payment_failed \
--add invoice:customer=cus_123`);

await setTimeout(1000);
Expand Down

0 comments on commit c09bd19

Please sign in to comment.