/* eslint-disable @typescript-eslint/no-unused-vars */ import { SNSClient, PublishCommandOutput } from '@aws-sdk/client-sns'; import AwsSMSSenderClient from './awsSmsSender.client'; jest.mock('@aws-sdk/client-sns', () => { const actualModule = jest.requireActual('@aws-sdk/client-sns'); class SNSClient { send( phones: string[] = [], message: string, ): Promise { return Promise.resolve({} as PublishCommandOutput); } } return { ...actualModule, SNSClient, }; }); jest.mock('../../utils/constants', () => ({ REGION: 'us-east-1', USERNAME: 'qrvey', PASSWORD: '123456', })); describe('AwsSMSSender tests.', () => { beforeEach(() => { jest.clearAllMocks(); jest.resetAllMocks(); }); test('Should call send method.', async () => { const smsSender = new AwsSMSSenderClient(); const clientSend = jest.spyOn(SNSClient.prototype, 'send'); await smsSender.send(['+1234567890', '+9876543210'], 'Hello world'); expect(clientSend).toHaveBeenCalledTimes(2); }); });