Skip to content

Commit

Permalink
fix: Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Nov 26, 2024
1 parent 20a4fe3 commit 069e5f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/stripe/stripe.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('StripeController', () => {
checkout: { sessions: { create: jest.fn() } },
paymentIntents: { retrieve: jest.fn() },
refunds: { create: jest.fn() },
setupIntents: { retrieve: jest.fn() },
setupIntents: { retrieve: jest.fn(), update: jest.fn() },
customers: { create: jest.fn(), list: jest.fn() },
paymentMethods: { attach: jest.fn() },
products: { search: jest.fn(), create: jest.fn() },
Expand Down Expand Up @@ -199,7 +199,7 @@ describe('StripeController', () => {
reason: 'requested_by_customer',
})
})
it(`should not call setupintents.update if campaign can't accept donations`, async () => {
it(`should not call setupintents.update if no campaignId is provided`, async () => {
prismaMock.campaign.findFirst.mockResolvedValue({
id: 'complete-campaign',
allowDonationOnComplete: false,
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/stripe/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export class StripeService {
): Promise<Stripe.Response<Stripe.SetupIntent>> {
if (!inputDto.metadata.campaignId)
throw new BadRequestException('campaignId is missing from metadata')
await this.campaignService.validateCampaignId(
inputDto.metadata.campaignId as string,
)
return await this.stripeClient.setupIntents.update(id, inputDto, { idempotencyKey })
}
/**
Expand Down

0 comments on commit 069e5f9

Please sign in to comment.