diff --git a/src/app/services/sms/__tests__/sms.factory.spec.ts b/src/app/services/sms/__tests__/sms.factory.spec.ts index 0714aaebec..812208febd 100644 --- a/src/app/services/sms/__tests__/sms.factory.spec.ts +++ b/src/app/services/sms/__tests__/sms.factory.spec.ts @@ -1,4 +1,3 @@ -import { ObjectId } from 'bson' import { okAsync } from 'neverthrow' import Twilio from 'twilio' @@ -6,7 +5,7 @@ import { ISms } from 'src/app/config/features/sms.config' import { createSmsFactory } from '../sms.factory' import * as SmsService from '../sms.service' -import { BounceNotificationSmsParams, TwilioConfig } from '../sms.types' +import { TwilioConfig } from '../sms.types' // This is hoisted and thus a const cannot be passed in. jest.mock('twilio', () => @@ -24,15 +23,6 @@ const MOCKED_TWILIO = { mocked: 'this is mocked', } as unknown as Twilio.Twilio -const MOCK_BOUNCE_SMS_PARAMS: BounceNotificationSmsParams = { - adminEmail: 'admin@email.com', - adminId: new ObjectId().toHexString(), - formId: new ObjectId().toHexString(), - formTitle: 'mock form title', - recipient: '+6581234567', - recipientEmail: 'recipient@email.com', -} - describe('sms.factory', () => { beforeEach(() => jest.clearAllMocks()) @@ -49,28 +39,6 @@ describe('sms.factory', () => { } const SmsFactory = createSmsFactory(MOCK_SMS_FEATURE) - it('should call SmsService counterpart when invoking sendAdminContactOtp', async () => { - // Arrange - MockSmsService.sendAdminContactOtp.mockReturnValueOnce(okAsync(true)) - - const mockArguments: Parameters = [ - 'mockRecipient', - 'mockOtp', - 'mockFormId', - 'mockSenderIp', - ] - - // Act - await SmsFactory.sendAdminContactOtp(...mockArguments) - - // Assert - expect(MockSmsService.sendAdminContactOtp).toHaveBeenCalledTimes(1) - expect(MockSmsService.sendAdminContactOtp).toHaveBeenCalledWith( - ...mockArguments, - expectedTwilioConfig, - ) - }) - it('should call SmsService counterpart when invoking sendVerificationOtp', async () => { // Arrange MockSmsService.sendVerificationOtp.mockReturnValue(okAsync(true)) @@ -93,26 +61,4 @@ describe('sms.factory', () => { expectedTwilioConfig, ) }) - - it('should call SmsService when sendFormDeactivatedSms is called', async () => { - MockSmsService.sendFormDeactivatedSms.mockReturnValue(okAsync(true)) - - await SmsFactory.sendFormDeactivatedSms(MOCK_BOUNCE_SMS_PARAMS) - - expect(MockSmsService.sendFormDeactivatedSms).toHaveBeenCalledWith( - MOCK_BOUNCE_SMS_PARAMS, - expectedTwilioConfig, - ) - }) - - it('should call SmsService when sendBouncedSubmissionSms is called', async () => { - MockSmsService.sendBouncedSubmissionSms.mockReturnValue(okAsync(true)) - - await SmsFactory.sendBouncedSubmissionSms(MOCK_BOUNCE_SMS_PARAMS) - - expect(MockSmsService.sendBouncedSubmissionSms).toHaveBeenCalledWith( - MOCK_BOUNCE_SMS_PARAMS, - expectedTwilioConfig, - ) - }) })