Skip to content

Commit

Permalink
mock aws sdk value
Browse files Browse the repository at this point in the history
  • Loading branch information
hhassan01 committed Aug 30, 2024
1 parent 643c044 commit d950757
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/handlers/createTransactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import { connectToDatabase } from '../../src/utils/connectToDB'
import { handler as createTransactionHandler } from '../../src/handlers/createTransaction'

jest.mock('../../src/utils/connectToDB')
jest.mock('aws-sdk', () => {
const EventBridge = {
putEvents: jest.fn().mockReturnThis(),
promise: jest.fn().mockResolvedValue({}),
};
return { EventBridge: jest.fn(() => EventBridge) };
});

describe('createTransactionHandler', () => {
beforeAll(async () => {
Expand Down
7 changes: 7 additions & 0 deletions tests/services/transactionsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import {
} from '../../src/dto/transaction'

jest.mock('../../src/services/accountsService')
jest.mock('aws-sdk', () => {
const EventBridge = {
putEvents: jest.fn().mockReturnThis(),
promise: jest.fn().mockResolvedValue({}),
};
return { EventBridge: jest.fn(() => EventBridge) };
});

describe('TransactionsService', () => {
let transactionsService: TransactionsService
Expand Down

0 comments on commit d950757

Please sign in to comment.