Skip to content

Commit

Permalink
chore: Try to log in try catch clause
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Dec 9, 2024
1 parent febd7da commit 0a5f9ef
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions apps/api/src/stripe/stripe.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,16 @@ describe('StripeController', () => {
state: CampaignState.complete,
title: 'active-campaign',
} as Campaign)
await expect(controller.setupIntentToSubscription('123').catch((err) => console.log(err))).toResolve()
expect(stripeMock.setupIntents.retrieve).toHaveBeenCalledWith('123', {
expand: ['payment_method'],
})
expect(stripeMock.customers.create).not.toHaveBeenCalled()
expect(stripeMock.products.create).not.toHaveBeenCalled()
try {

await expect(controller.setupIntentToSubscription('123')).toResolve()
expect(stripeMock.setupIntents.retrieve).toHaveBeenCalledWith('123', {
expand: ['payment_method'],
})
expect(stripeMock.customers.create).not.toHaveBeenCalled()
expect(stripeMock.products.create).not.toHaveBeenCalled()
} catch (err) {
throw new Error(JSON.stringify(err))

Check failure on line 239 in apps/api/src/stripe/stripe.controller.spec.ts

View workflow job for this annotation

GitHub Actions / JEST Tests

StripeController ► StripeController should subscription without creating new customer,products ► StripeController should subscription without creating new customer,products

Failed test found in: test-results.xml Error: Error: {"matcherResult":{"pass":false,"message":"expect(received).toResolve()\n\nExpected promise to resolve, however it rejected.\n"},"message":"expect(received).toResolve()\n\nExpected promise to resolve, however it rejected.\n"}
Raw output
Error: {"matcherResult":{"pass":false,"message":"expect(received).toResolve()\n\nExpected promise to resolve, however it rejected.\n"},"message":"expect(received).toResolve()\n\nExpected promise to resolve, however it rejected.\n"}
    at Object.<anonymous> (/home/runner/work/api/api/apps/api/src/stripe/stripe.controller.spec.ts:239:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
}
})
})

0 comments on commit 0a5f9ef

Please sign in to comment.