Skip to content

Commit

Permalink
chore: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Dec 9, 2024
1 parent 5b92306 commit 4e5f115
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/api/src/stripe/stripe.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { NotificationModule } from '../sockets/notifications/notification.module
import { KeycloakTokenParsed } from '../auth/keycloak'
describe('StripeController', () => {
let controller: StripeController
const idempotencyKey = 'test_123'
const stripeMock = {
checkout: { sessions: { create: jest.fn() } },
paymentIntents: { retrieve: jest.fn() },
Expand Down Expand Up @@ -212,7 +211,7 @@ describe('StripeController', () => {
},
}

await expect(controller.updateSetupIntent('123', idempotencyKey, payload)).rejects.toThrow(
await expect(controller.updateSetupIntent('123', payload)).rejects.toThrow(
new NotAcceptableException('Campaign cannot accept donations in state: complete'),
)
})
Expand All @@ -228,7 +227,7 @@ describe('StripeController', () => {
state: CampaignState.complete,
title: 'active-campaign',
} as Campaign)
await expect(controller.setupIntentToSubscription('123', idempotencyKey)).toResolve()
await expect(controller.setupIntentToSubscription('123')).toResolve()

Check failure on line 230 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 test-results.xml Error: Error: expect(received).toResolve()
Raw output
Error: expect(received).toResolve()

Expected promise to resolve, however it rejected.

    at Object.<anonymous> (/home/runner/work/api/api/apps/api/src/stripe/stripe.controller.spec.ts:230:63)
    at Promise.then.completed (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/utils.js:293:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/utils.js:226:10)
    at _callCircusTest (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/run.js:297:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at _runTest (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/run.js:233:3)
    at _runTestsForDescribeBlock (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/run.js:135:9)
    at _runTestsForDescribeBlock (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/run.js:130:9)
    at run (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/run.js:68:3)
    at runAndTransformResultsToJestFormat (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/home/runner/work/api/api/node_modules/@jest/core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/home/runner/work/api/api/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/home/runner/work/api/api/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/home/runner/work/api/api/node_modules/jest-runner/build/testWorker.js:106:12)
expect(stripeMock.setupIntents.retrieve).toHaveBeenCalledWith('123', {
expand: ['payment_method'],
})
Expand Down

0 comments on commit 4e5f115

Please sign in to comment.