cap-creatives-ui 8.0.280 → 8.0.321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/pr-title-check.yml +88 -0
- package/app/constants/unified.js +21 -1
- package/app/containers/App/constants.js +0 -1
- package/app/containers/Login/test/index.test.js +123 -0
- package/app/containers/Login/test/selectors.test.js +165 -0
- package/app/initialState.js +0 -2
- package/app/services/api.js +6 -0
- package/app/services/tests/api.test.js +7 -0
- package/app/services/tests/getSchema.test.js +95 -0
- package/app/utils/common.js +23 -9
- package/app/utils/commonUtils.js +64 -93
- package/app/utils/tagValidations.js +83 -219
- package/app/utils/templateVarUtils.js +172 -0
- package/app/utils/tests/common.test.js +265 -323
- package/app/utils/tests/commonUtil.test.js +461 -118
- package/app/utils/tests/commonUtils.test.js +581 -0
- package/app/utils/tests/messageUtils.test.js +95 -0
- package/app/utils/tests/smsCharCount.test.js +304 -0
- package/app/utils/tests/smsCharCountV2.test.js +213 -10
- package/app/utils/tests/tagValidations.test.js +474 -357
- package/app/utils/tests/templateVarUtils.test.js +160 -0
- package/app/v2Components/CapDeviceContent/index.js +10 -7
- package/app/v2Components/CapTagList/index.js +32 -24
- package/app/v2Components/CapTagList/style.scss +48 -0
- package/app/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/app/v2Components/CapTagListWithInput/index.js +8 -0
- package/app/v2Components/CapWhatsappCTA/index.js +2 -0
- package/app/v2Components/CapWhatsappCarouselButton/index.js +32 -14
- package/app/v2Components/CapWhatsappCarouselButton/tests/index.test.js +120 -2
- package/app/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +39 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +606 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +36 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +79 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/index.js +314 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +141 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +156 -0
- package/app/v2Components/CommonTestAndPreview/SendTestMessage.js +57 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/app/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +210 -4
- package/app/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/app/v2Components/CommonTestAndPreview/constants.js +57 -1
- package/app/v2Components/CommonTestAndPreview/index.js +878 -156
- package/app/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/app/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/app/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/app/v2Components/CommonTestAndPreview/sagas.js +75 -5
- package/app/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/app/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +1156 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +334 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +576 -0
- package/app/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +156 -0
- package/app/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/app/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/app/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -7
- package/app/v2Components/CommonTestAndPreview/tests/index.test.js +914 -5
- package/app/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/app/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/app/v2Components/CommonTestAndPreview/tests/sagas.test.js +146 -378
- package/app/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- package/app/v2Components/ErrorInfoNote/index.js +24 -26
- package/app/v2Components/FormBuilder/index.js +182 -204
- package/app/v2Components/FormBuilder/messages.js +4 -8
- package/app/v2Components/HtmlEditor/HTMLEditor.js +7 -6
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -1
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +928 -17
- package/app/v2Components/HtmlEditor/components/CodeEditorPane/index.js +4 -2
- package/app/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +452 -3
- package/app/v2Components/HtmlEditor/hooks/useValidation.js +12 -9
- package/app/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +132 -0
- package/app/v2Components/HtmlEditor/utils/htmlValidator.js +4 -2
- package/app/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/app/v2Components/SmsFallback/constants.js +73 -0
- package/app/v2Components/SmsFallback/index.js +956 -0
- package/app/v2Components/SmsFallback/index.scss +265 -0
- package/app/v2Components/SmsFallback/messages.js +78 -0
- package/app/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/app/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/app/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/app/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/app/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/app/v2Components/TestAndPreviewSlidebox/index.js +22 -1
- package/app/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/app/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/app/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/app/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/app/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/app/v2Containers/BeeEditor/index.js +3 -0
- package/app/v2Containers/BeePopupEditor/index.js +9 -2
- package/app/v2Containers/Cap/mockData.js +0 -14
- package/app/v2Containers/Cap/reducer.js +3 -55
- package/app/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/app/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/app/v2Containers/CommunicationFlow/constants.js +200 -0
- package/app/v2Containers/CommunicationFlow/index.js +102 -0
- package/app/v2Containers/CommunicationFlow/messages.js +346 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/app/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/app/v2Containers/CreativesContainer/SlideBoxContent.js +127 -11
- package/app/v2Containers/CreativesContainer/SlideBoxFooter.js +62 -9
- package/app/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/app/v2Containers/CreativesContainer/constants.js +24 -0
- package/app/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/app/v2Containers/CreativesContainer/index.js +346 -71
- package/app/v2Containers/CreativesContainer/index.scss +51 -1
- package/app/v2Containers/CreativesContainer/messages.js +12 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +69 -1
- package/app/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +443 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +147 -4
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +57 -10
- package/app/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/app/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/app/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/app/v2Containers/Email/index.js +2 -5
- package/app/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +58 -77
- package/app/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +158 -89
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/app/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +17 -12
- package/app/v2Containers/EmailWrapper/index.js +4 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +133 -0
- package/app/v2Containers/FTP/index.js +2 -51
- package/app/v2Containers/FTP/messages.js +0 -4
- package/app/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +110 -155
- package/app/v2Containers/InApp/index.js +297 -118
- package/app/v2Containers/InApp/tests/index.test.js +17 -6
- package/app/v2Containers/InApp/tests/mockData.js +1 -1
- package/app/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/app/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/app/v2Containers/InAppWrapper/index.js +3 -0
- package/app/v2Containers/InappAdvance/index.js +5 -104
- package/app/v2Containers/InappAdvance/tests/index.test.js +2 -0
- package/app/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +24 -3
- package/app/v2Containers/Line/Container/Text/index.js +0 -1
- package/app/v2Containers/MobilePush/Create/index.js +105 -28
- package/app/v2Containers/MobilePush/Create/messages.js +4 -0
- package/app/v2Containers/MobilePush/Edit/index.js +250 -68
- package/app/v2Containers/MobilePush/Edit/messages.js +4 -0
- package/app/v2Containers/MobilePushNew/components/PlatformContentFields.js +36 -12
- package/app/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +68 -27
- package/app/v2Containers/MobilePushNew/index.js +78 -35
- package/app/v2Containers/MobilePushNew/messages.js +8 -0
- package/app/v2Containers/MobilepushWrapper/index.js +11 -1
- package/app/v2Containers/Rcs/constants.js +32 -1
- package/app/v2Containers/Rcs/index.js +963 -916
- package/app/v2Containers/Rcs/index.scss +85 -6
- package/app/v2Containers/Rcs/messages.js +10 -1
- package/app/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/app/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +41136 -1566
- package/app/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/app/v2Containers/Rcs/tests/index.test.js +41 -38
- package/app/v2Containers/Rcs/tests/mockData.js +38 -0
- package/app/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/app/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/app/v2Containers/Rcs/utils.js +358 -10
- package/app/v2Containers/Sms/Create/index.js +122 -39
- package/app/v2Containers/Sms/Create/messages.js +4 -0
- package/app/v2Containers/Sms/Edit/index.js +37 -3
- package/app/v2Containers/Sms/commonMethods.js +3 -6
- package/app/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/app/v2Containers/Sms/tests/commonMethods.test.js +122 -0
- package/app/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/app/v2Containers/SmsTrai/Create/index.js +9 -4
- package/app/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/app/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/app/v2Containers/SmsTrai/Edit/index.js +667 -160
- package/app/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/app/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/app/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4590 -2436
- package/app/v2Containers/SmsWrapper/index.js +41 -8
- package/app/v2Containers/TagList/index.js +63 -2
- package/app/v2Containers/TagList/messages.js +8 -0
- package/app/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/app/v2Containers/TagList/tests/mockdata.js +17 -0
- package/app/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/app/v2Containers/Templates/_templates.scss +61 -2
- package/app/v2Containers/Templates/actions.js +11 -0
- package/app/v2Containers/Templates/constants.js +2 -0
- package/app/v2Containers/Templates/index.js +90 -40
- package/app/v2Containers/Templates/reducer.js +3 -1
- package/app/v2Containers/Templates/sagas.js +57 -12
- package/app/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/app/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/app/v2Containers/Templates/tests/reducer.test.js +12 -0
- package/app/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/app/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/app/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/app/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/app/v2Containers/TemplatesV2/index.js +147 -49
- package/app/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/app/v2Containers/Viber/index.js +9 -10
- package/app/v2Containers/Viber/index.scss +1 -1
- package/app/v2Containers/WebPush/Create/components/BrandIconSection.test.js +264 -0
- package/app/v2Containers/WebPush/Create/components/MessageSection.js +78 -19
- package/app/v2Containers/WebPush/Create/components/MessageSection.test.js +82 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/BrandIconSection.test.js.snap +187 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +25 -17
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.js +80 -0
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.test.js +210 -0
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -5
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/app/v2Containers/WebPush/Create/index.js +36 -6
- package/app/v2Containers/WebPush/Create/index.scss +5 -0
- package/app/v2Containers/WebPush/Create/messages.js +8 -1
- package/app/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +269 -0
- package/app/v2Containers/WebPush/Create/utils/validation.js +31 -15
- package/app/v2Containers/WebPush/Create/utils/validation.test.js +72 -24
- package/app/v2Containers/Whatsapp/index.js +28 -53
- package/app/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26939 -3982
- package/app/v2Containers/Whatsapp/tests/index.test.js +172 -0
- package/app/v2Containers/Zalo/index.js +5 -11
- package/package.json +2 -2
- package/version +9 -0
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for parseSenderDetailsResponse
|
|
3
|
+
* Covers sender ID / delivery settings response parsing for SMS, EMAIL, WHATSAPP
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { parseSenderDetailsResponse } from '../../../DeliverySettings/utils/parseSenderDetailsResponse';
|
|
7
|
+
|
|
8
|
+
describe('parseSenderDetailsResponse', () => {
|
|
9
|
+
describe('when entity is missing or null', () => {
|
|
10
|
+
it('should return empty domains when response is null', () => {
|
|
11
|
+
expect(parseSenderDetailsResponse('SMS', null)).toEqual({ domains: [] });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return empty domains when response is undefined', () => {
|
|
15
|
+
expect(parseSenderDetailsResponse('SMS', undefined)).toEqual({ domains: [] });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should return empty domains when entity is missing', () => {
|
|
19
|
+
expect(parseSenderDetailsResponse('SMS', {})).toEqual({ domains: [] });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('when entity is object with channel key', () => {
|
|
24
|
+
it('should parse SMS channel entity array', () => {
|
|
25
|
+
const response = {
|
|
26
|
+
entity: {
|
|
27
|
+
SMS: [
|
|
28
|
+
{
|
|
29
|
+
id: 10,
|
|
30
|
+
priority: 1,
|
|
31
|
+
domainProperties: {
|
|
32
|
+
domainName: 'SMS Domain 1',
|
|
33
|
+
id: 100,
|
|
34
|
+
contactInfo: [
|
|
35
|
+
{ type: 'gsm_sender_id', valid: true, value: 'GSM1', default: true },
|
|
36
|
+
{ type: 'cdma_sender_id', valid: true, value: 'CDMA1' },
|
|
37
|
+
],
|
|
38
|
+
connectionProperties: {},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
45
|
+
expect(result.domains).toHaveLength(1);
|
|
46
|
+
expect(result.domains[0]).toMatchObject({
|
|
47
|
+
dgmId: 10,
|
|
48
|
+
domainName: 'SMS Domain 1',
|
|
49
|
+
domainId: 100,
|
|
50
|
+
priority: 1,
|
|
51
|
+
});
|
|
52
|
+
expect(result.domains[0].gsmSenders).toHaveLength(1);
|
|
53
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('GSM1');
|
|
54
|
+
expect(result.domains[0].cdmaSenders).toHaveLength(1);
|
|
55
|
+
expect(result.domains[0].cdmaSenders[0].value).toBe('CDMA1');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should populate SMS senders when channel argument is lowercase (normalized for branches)', () => {
|
|
59
|
+
const response = {
|
|
60
|
+
entity: {
|
|
61
|
+
SMS: [
|
|
62
|
+
{
|
|
63
|
+
id: 10,
|
|
64
|
+
priority: 1,
|
|
65
|
+
domainProperties: {
|
|
66
|
+
domainName: 'SMS Domain 1',
|
|
67
|
+
id: 100,
|
|
68
|
+
contactInfo: [
|
|
69
|
+
{ type: 'gsm_sender_id', valid: true, value: 'GSM1', default: true },
|
|
70
|
+
{ type: 'cdma_sender_id', valid: true, value: 'CDMA1' },
|
|
71
|
+
],
|
|
72
|
+
connectionProperties: {},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const result = parseSenderDetailsResponse('sms', response);
|
|
79
|
+
expect(result.domains).toHaveLength(1);
|
|
80
|
+
expect(result.domains[0].gsmSenders).toHaveLength(1);
|
|
81
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('GSM1');
|
|
82
|
+
expect(result.domains[0].cdmaSenders).toHaveLength(1);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should parse EMAIL channel entity array', () => {
|
|
86
|
+
const response = {
|
|
87
|
+
entity: {
|
|
88
|
+
EMAIL: [
|
|
89
|
+
{
|
|
90
|
+
id: 20,
|
|
91
|
+
priority: 0,
|
|
92
|
+
domainProperties: {
|
|
93
|
+
domainName: 'Email Domain',
|
|
94
|
+
id: 200,
|
|
95
|
+
contactInfo: [
|
|
96
|
+
{ type: 'sender_id', valid: true, value: 'noreply@example.com' },
|
|
97
|
+
{ type: 'reply_to_id', valid: true, value: 'reply@example.com' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
const result = parseSenderDetailsResponse('EMAIL', response);
|
|
105
|
+
expect(result.domains).toHaveLength(1);
|
|
106
|
+
expect(result.domains[0]).toMatchObject({
|
|
107
|
+
dgmId: 20,
|
|
108
|
+
domainName: 'Email Domain',
|
|
109
|
+
domainId: 200,
|
|
110
|
+
priority: 0,
|
|
111
|
+
});
|
|
112
|
+
expect(result.domains[0].emailSenders).toHaveLength(1);
|
|
113
|
+
expect(result.domains[0].emailSenders[0].value).toBe('noreply@example.com');
|
|
114
|
+
expect(result.domains[0].emailRepliers).toHaveLength(1);
|
|
115
|
+
expect(result.domains[0].emailRepliers[0].value).toBe('reply@example.com');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('should parse WHATSAPP channel with sourceAccountIdentifier', () => {
|
|
119
|
+
const response = {
|
|
120
|
+
entity: {
|
|
121
|
+
WHATSAPP: [
|
|
122
|
+
{
|
|
123
|
+
id: 30,
|
|
124
|
+
priority: 0,
|
|
125
|
+
domainProperties: {
|
|
126
|
+
domainName: 'WABA Domain',
|
|
127
|
+
id: 300,
|
|
128
|
+
contactInfo: [],
|
|
129
|
+
connectionProperties: {
|
|
130
|
+
sourceAccountIdentifier: 'waba-123',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
const result = parseSenderDetailsResponse('WHATSAPP', response);
|
|
138
|
+
expect(result.domains).toHaveLength(1);
|
|
139
|
+
expect(result.domains[0].sourceAccountIdentifier).toBe('waba-123');
|
|
140
|
+
expect(result.domains[0].gsmSenders).toEqual([]);
|
|
141
|
+
expect(result.domains[0].cdmaSenders).toEqual([]);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('when entity is direct array', () => {
|
|
146
|
+
it('should use entity as channelSenderDetails when entity is array', () => {
|
|
147
|
+
const response = {
|
|
148
|
+
entity: [
|
|
149
|
+
{
|
|
150
|
+
id: 1,
|
|
151
|
+
priority: 0,
|
|
152
|
+
domainProperties: { domainName: 'Direct Domain', id: 1 },
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
157
|
+
expect(result.domains).toHaveLength(1);
|
|
158
|
+
expect(result.domains[0].domainName).toBe('Direct Domain');
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('filtering and sorting', () => {
|
|
163
|
+
it('should filter contactInfo by type and valid', () => {
|
|
164
|
+
const response = {
|
|
165
|
+
entity: {
|
|
166
|
+
SMS: [
|
|
167
|
+
{
|
|
168
|
+
id: 1,
|
|
169
|
+
priority: 0,
|
|
170
|
+
domainProperties: {
|
|
171
|
+
domainName: 'D1',
|
|
172
|
+
id: 1,
|
|
173
|
+
contactInfo: [
|
|
174
|
+
{ type: 'gsm_sender_id', valid: true, value: 'A' },
|
|
175
|
+
{ type: 'gsm_sender_id', valid: false, value: 'B' },
|
|
176
|
+
{ type: 'other', valid: true, value: 'C' },
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
184
|
+
expect(result.domains[0].gsmSenders).toHaveLength(1);
|
|
185
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('A');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('should sort domains by priority', () => {
|
|
189
|
+
const response = {
|
|
190
|
+
entity: {
|
|
191
|
+
SMS: [
|
|
192
|
+
{ id: 1, priority: 2, domainProperties: { domainName: 'Second', id: 1 } },
|
|
193
|
+
{ id: 2, priority: 0, domainProperties: { domainName: 'First', id: 2 } },
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
198
|
+
expect(result.domains[0].domainName).toBe('First');
|
|
199
|
+
expect(result.domains[1].domainName).toBe('Second');
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('should dedupe by domainName keeping first occurrence', () => {
|
|
203
|
+
const response = {
|
|
204
|
+
entity: {
|
|
205
|
+
SMS: [
|
|
206
|
+
{ id: 1, priority: 0, domainProperties: { domainName: 'Same', id: 1 } },
|
|
207
|
+
{ id: 2, priority: 1, domainProperties: { domainName: 'Same', id: 2 } },
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
212
|
+
expect(result.domains).toHaveLength(1);
|
|
213
|
+
expect(result.domains[0].domainId).toBe(1);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
describe('edge cases', () => {
|
|
218
|
+
it('should return empty domains when channel key has no array', () => {
|
|
219
|
+
const response = { entity: { SMS: null } };
|
|
220
|
+
expect(parseSenderDetailsResponse('SMS', response)).toEqual({ domains: [] });
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('should return empty domains when channel key is missing and entity is not array', () => {
|
|
224
|
+
const response = { entity: { EMAIL: [] } };
|
|
225
|
+
expect(parseSenderDetailsResponse('SMS', response)).toEqual({ domains: [] });
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it('should handle missing domainProperties with defaults', () => {
|
|
229
|
+
const response = {
|
|
230
|
+
entity: {
|
|
231
|
+
SMS: [{ id: 1, priority: 0 }],
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
235
|
+
expect(result.domains).toHaveLength(1);
|
|
236
|
+
expect(result.domains[0].domainId).toBe(-1);
|
|
237
|
+
expect(result.domains[0].domainName).toBeUndefined();
|
|
238
|
+
expect(result.domains[0].gsmSenders).toEqual([]);
|
|
239
|
+
expect(result.domains[0].cdmaSenders).toEqual([]);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it('should use wabaId when sourceAccountIdentifier missing for WHATSAPP', () => {
|
|
243
|
+
const response = {
|
|
244
|
+
entity: {
|
|
245
|
+
WHATSAPP: [
|
|
246
|
+
{
|
|
247
|
+
id: 1,
|
|
248
|
+
priority: 0,
|
|
249
|
+
domainProperties: {
|
|
250
|
+
domainName: 'W',
|
|
251
|
+
id: 1,
|
|
252
|
+
connectionProperties: { wabaId: 'waba-456' },
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
const result = parseSenderDetailsResponse('WHATSAPP', response);
|
|
259
|
+
expect(result.domains[0].sourceAccountIdentifier).toBe('waba-456');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('should map hostName to domainName when domainName missing (RCS)', () => {
|
|
263
|
+
const response = {
|
|
264
|
+
entity: {
|
|
265
|
+
RCS: [
|
|
266
|
+
{
|
|
267
|
+
id: 1,
|
|
268
|
+
priority: 0,
|
|
269
|
+
domainProperties: {
|
|
270
|
+
hostName: 'rcs-host',
|
|
271
|
+
id: 42,
|
|
272
|
+
contactInfo: [
|
|
273
|
+
{ type: 'gsm_sender_id', valid: true, value: 'S1', default: true },
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
const result = parseSenderDetailsResponse('RCS', response);
|
|
281
|
+
expect(result.domains[0].domainName).toBe('rcs-host');
|
|
282
|
+
expect(result.domains[0].domainId).toBe(42);
|
|
283
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('S1');
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('should unwrap result.entity when top-level entity is absent', () => {
|
|
287
|
+
const response = {
|
|
288
|
+
result: {
|
|
289
|
+
entity: {
|
|
290
|
+
SMS: [
|
|
291
|
+
{
|
|
292
|
+
id: 1,
|
|
293
|
+
priority: 0,
|
|
294
|
+
domainProperties: {
|
|
295
|
+
domainName: 'ViaResult',
|
|
296
|
+
id: 9,
|
|
297
|
+
contactInfo: [{ type: 'gsm_sender_id', valid: true, value: 'G' }],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
305
|
+
expect(result.domains[0].domainName).toBe('ViaResult');
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('should merge rcs_sender_id into gsmSenders for RCS', () => {
|
|
309
|
+
const response = {
|
|
310
|
+
entity: {
|
|
311
|
+
RCS: [
|
|
312
|
+
{
|
|
313
|
+
id: 1,
|
|
314
|
+
priority: 0,
|
|
315
|
+
domainProperties: {
|
|
316
|
+
domainName: 'RCS Domain',
|
|
317
|
+
id: 1,
|
|
318
|
+
contactInfo: [
|
|
319
|
+
{ type: 'rcs_sender_id', valid: true, value: 'RCS123', default: true },
|
|
320
|
+
],
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
const result = parseSenderDetailsResponse('RCS', response);
|
|
327
|
+
expect(result.domains[0].gsmSenders).toHaveLength(1);
|
|
328
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('RCS123');
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('should unwrap data.entity when top-level entity is absent', () => {
|
|
332
|
+
const response = {
|
|
333
|
+
data: {
|
|
334
|
+
entity: {
|
|
335
|
+
SMS: [
|
|
336
|
+
{
|
|
337
|
+
id: 1,
|
|
338
|
+
priority: 0,
|
|
339
|
+
domainProperties: {
|
|
340
|
+
domainName: 'ViaData',
|
|
341
|
+
id: 9,
|
|
342
|
+
contactInfo: [{ type: 'gsm_sender_id', valid: true, value: 'G' }],
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
350
|
+
expect(result.domains[0].domainName).toBe('ViaData');
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should return empty domains when entity is explicitly null', () => {
|
|
354
|
+
expect(parseSenderDetailsResponse('SMS', { entity: null })).toEqual({ domains: [] });
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it('should return empty when channel data is a non-domain object', () => {
|
|
358
|
+
expect(parseSenderDetailsResponse('SMS', { entity: { notAnArray: true } })).toEqual({ domains: [] });
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('should use userid when sourceAccountIdentifier and wabaId are missing (WHATSAPP)', () => {
|
|
362
|
+
const response = {
|
|
363
|
+
entity: {
|
|
364
|
+
WHATSAPP: [
|
|
365
|
+
{
|
|
366
|
+
id: 1,
|
|
367
|
+
priority: 0,
|
|
368
|
+
domainProperties: {
|
|
369
|
+
domainName: 'W',
|
|
370
|
+
id: 1,
|
|
371
|
+
connectionProperties: { userid: 'user-99' },
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
const result = parseSenderDetailsResponse('WHATSAPP', response);
|
|
378
|
+
expect(result.domains[0].sourceAccountIdentifier).toBe('user-99');
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('should dedupe duplicate GSM values for RCS (merged contact types)', () => {
|
|
382
|
+
const response = {
|
|
383
|
+
entity: {
|
|
384
|
+
RCS: [
|
|
385
|
+
{
|
|
386
|
+
id: 1,
|
|
387
|
+
priority: 0,
|
|
388
|
+
domainProperties: {
|
|
389
|
+
domainName: 'R',
|
|
390
|
+
id: 1,
|
|
391
|
+
contactInfo: [
|
|
392
|
+
{ type: 'gsm_sender_id', valid: true, value: 'SAME', default: true },
|
|
393
|
+
{ type: 'rcs_sender_id', valid: true, value: 'SAME' },
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
const result = parseSenderDetailsResponse('RCS', response);
|
|
401
|
+
expect(result.domains[0].gsmSenders.filter((r) => r.value === 'SAME')).toHaveLength(1);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it('should return empty domains when response is not an object', () => {
|
|
405
|
+
expect(parseSenderDetailsResponse('SMS', 42)).toEqual({ domains: [] });
|
|
406
|
+
expect(parseSenderDetailsResponse('SMS', 'x')).toEqual({ domains: [] });
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it('should return empty domains when entity is empty string', () => {
|
|
410
|
+
expect(parseSenderDetailsResponse('SMS', { entity: '' })).toEqual({ domains: [] });
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it('should normalize hyphenated contactInfo.type to match gsm_sender_id', () => {
|
|
414
|
+
const response = {
|
|
415
|
+
entity: {
|
|
416
|
+
SMS: [
|
|
417
|
+
{
|
|
418
|
+
id: 1,
|
|
419
|
+
domainProperties: {
|
|
420
|
+
domainName: 'D',
|
|
421
|
+
id: 1,
|
|
422
|
+
contactInfo: [
|
|
423
|
+
{ type: 'gsm-sender-id', valid: true, value: 'HYPH' },
|
|
424
|
+
],
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
431
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('HYPH');
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it('should skip whitespace-only GSM values when merging RCS contact types', () => {
|
|
435
|
+
const response = {
|
|
436
|
+
entity: {
|
|
437
|
+
RCS: [
|
|
438
|
+
{
|
|
439
|
+
id: 1,
|
|
440
|
+
domainProperties: {
|
|
441
|
+
domainName: 'R',
|
|
442
|
+
id: 1,
|
|
443
|
+
contactInfo: [
|
|
444
|
+
{ type: 'gsm_sender_id', valid: true, value: ' ' },
|
|
445
|
+
{ type: 'gsm_sender_id', valid: true, value: 'OK' },
|
|
446
|
+
],
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
],
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
const values = parseSenderDetailsResponse('RCS', response).domains[0].gsmSenders.map((g) => g.value);
|
|
453
|
+
expect(values).toEqual(['OK']);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it('should use default priority 0 when priority is null', () => {
|
|
457
|
+
const response = {
|
|
458
|
+
entity: {
|
|
459
|
+
SMS: [
|
|
460
|
+
{
|
|
461
|
+
id: 1,
|
|
462
|
+
priority: null,
|
|
463
|
+
domainProperties: {
|
|
464
|
+
domainName: 'P',
|
|
465
|
+
id: 9,
|
|
466
|
+
contactInfo: [],
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
expect(parseSenderDetailsResponse('SMS', response).domains[0].priority).toBe(0);
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
it('should unwrap entity from raw response object when entity key is absent', () => {
|
|
476
|
+
const response = { misc: 1 };
|
|
477
|
+
expect(parseSenderDetailsResponse('SMS', response)).toEqual({ domains: [] });
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
describe('unwrapEntity edge cases', () => {
|
|
482
|
+
it('should return empty domains when entity key is explicitly null', () => {
|
|
483
|
+
// unwrapEntity: response.entity === null → returns null → parseSenderDetailsResponse returns { domains: [] }
|
|
484
|
+
expect(parseSenderDetailsResponse('SMS', { entity: null })).toEqual({ domains: [] });
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
describe('null or empty channel', () => {
|
|
489
|
+
it('should return empty domains when channel is null', () => {
|
|
490
|
+
const response = { entity: { SMS: [{ id: 1, domainProperties: { domainName: 'D', id: 10, contactInfo: [] } }] } };
|
|
491
|
+
expect(parseSenderDetailsResponse(null, response)).toEqual({ domains: [] });
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
it('should return empty domains when channel is empty string', () => {
|
|
495
|
+
const response = { entity: { SMS: [{ id: 1, domainProperties: { domainName: 'D', id: 10, contactInfo: [] } }] } };
|
|
496
|
+
expect(parseSenderDetailsResponse('', response)).toEqual({ domains: [] });
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
describe('single non-array domain object', () => {
|
|
501
|
+
it('should wrap single domain with domainProperties in an array and return one domain', () => {
|
|
502
|
+
const response = {
|
|
503
|
+
entity: {
|
|
504
|
+
SMS: {
|
|
505
|
+
id: 5,
|
|
506
|
+
domainProperties: {
|
|
507
|
+
domainName: 'SingleDomain',
|
|
508
|
+
id: 99,
|
|
509
|
+
contactInfo: [{ type: 'gsm_sender_id', valid: true, value: 'GSMSINGLE' }],
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
};
|
|
514
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
515
|
+
expect(result.domains).toHaveLength(1);
|
|
516
|
+
expect(result.domains[0].domainName).toBe('SingleDomain');
|
|
517
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('GSMSINGLE');
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('should return empty domains for single non-array domain without domainProperties', () => {
|
|
521
|
+
const response = {
|
|
522
|
+
entity: { SMS: { id: 5, someProp: 'value' } },
|
|
523
|
+
};
|
|
524
|
+
expect(parseSenderDetailsResponse('SMS', response)).toEqual({ domains: [] });
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
describe('deduplication by domainId when domainName is null', () => {
|
|
529
|
+
it('should deduplicate two entries sharing the same domainId when domainName is null', () => {
|
|
530
|
+
const response = {
|
|
531
|
+
entity: {
|
|
532
|
+
SMS: [
|
|
533
|
+
{
|
|
534
|
+
id: 10,
|
|
535
|
+
priority: 1,
|
|
536
|
+
domainProperties: { domainName: null, id: 42, contactInfo: [] },
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: 11,
|
|
540
|
+
priority: 2,
|
|
541
|
+
domainProperties: { domainName: null, id: 42, contactInfo: [] },
|
|
542
|
+
},
|
|
543
|
+
],
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
547
|
+
expect(result.domains).toHaveLength(1);
|
|
548
|
+
expect(result.domains[0].domainId).toBe(42);
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
describe('typeMatches null-type filtering', () => {
|
|
553
|
+
it('should exclude contactInfo items with null type from gsmSenders', () => {
|
|
554
|
+
const response = {
|
|
555
|
+
entity: {
|
|
556
|
+
SMS: [
|
|
557
|
+
{
|
|
558
|
+
id: 1,
|
|
559
|
+
domainProperties: {
|
|
560
|
+
domainName: 'D',
|
|
561
|
+
id: 1,
|
|
562
|
+
contactInfo: [
|
|
563
|
+
{ type: null, valid: true, value: 'EXCLUDED' },
|
|
564
|
+
{ type: 'gsm_sender_id', valid: true, value: 'INCLUDED' },
|
|
565
|
+
],
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
],
|
|
569
|
+
},
|
|
570
|
+
};
|
|
571
|
+
const result = parseSenderDetailsResponse('SMS', response);
|
|
572
|
+
expect(result.domains[0].gsmSenders).toHaveLength(1);
|
|
573
|
+
expect(result.domains[0].gsmSenders[0].value).toBe('INCLUDED');
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
});
|