@capillarytech/creatives-library 8.0.295 → 8.0.297
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/package.json +1 -1
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +33 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +420 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +36 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +63 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +239 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +111 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +88 -0
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +51 -1
- package/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/v2Components/CommonTestAndPreview/constants.js +15 -0
- package/v2Components/CommonTestAndPreview/index.js +200 -16
- package/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/v2Components/CommonTestAndPreview/sagas.js +61 -0
- package/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +889 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +221 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +235 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +135 -0
- package/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -0
- package/v2Components/CommonTestAndPreview/tests/index.test.js +783 -2
- package/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +145 -0
- package/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- package/v2Components/FormBuilder/index.js +1 -1
- package/v2Components/HtmlEditor/HTMLEditor.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +0 -1
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +3 -132
- package/v2Components/HtmlEditor/hooks/useValidation.js +9 -12
- package/v2Components/HtmlEditor/utils/htmlValidator.js +2 -4
- package/v2Components/TestAndPreviewSlidebox/index.js +14 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +2 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +18 -110
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +697 -12
- package/v2Containers/SmsTrai/Edit/index.js +5 -1
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +201 -0
- package/v2Containers/Whatsapp/index.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26242 -4225
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
11
11
|
import { IntlProvider } from 'react-intl';
|
|
12
12
|
import CommonTestAndPreview from '../index';
|
|
13
|
-
import { CHANNELS } from '../constants';
|
|
13
|
+
import { CHANNELS, MEDIA_TYPE_CAROUSEL } from '../constants';
|
|
14
14
|
|
|
15
15
|
// Mock html-to-text
|
|
16
16
|
jest.mock('html-to-text', () => ({
|
|
@@ -52,12 +52,14 @@ jest.mock('../CustomValuesEditor', () => {
|
|
|
52
52
|
};
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
+
let lastSendTestMessageProps = null;
|
|
55
56
|
jest.mock('../SendTestMessage', () => {
|
|
56
57
|
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
|
|
57
58
|
const ReactLib = require('react');
|
|
58
59
|
return {
|
|
59
60
|
__esModule: true,
|
|
60
|
-
default: function MockSendTestMessage() {
|
|
61
|
+
default: function MockSendTestMessage(props) {
|
|
62
|
+
lastSendTestMessageProps = props;
|
|
61
63
|
return ReactLib.createElement('div', { 'data-testid': 'send-test-message' }, 'Send Test Message');
|
|
62
64
|
},
|
|
63
65
|
};
|
|
@@ -122,6 +124,8 @@ describe('CommonTestAndPreview', () => {
|
|
|
122
124
|
getPrefilledValuesRequested: jest.fn(),
|
|
123
125
|
clearPrefilledValues: jest.fn(),
|
|
124
126
|
clearPreviewErrors: jest.fn(),
|
|
127
|
+
getSenderDetailsRequested: jest.fn(),
|
|
128
|
+
getWeCrmAccountsRequested: jest.fn(),
|
|
125
129
|
};
|
|
126
130
|
|
|
127
131
|
const defaultProps = {
|
|
@@ -171,10 +175,15 @@ describe('CommonTestAndPreview', () => {
|
|
|
171
175
|
fetchPrefilledValuesErrors: [],
|
|
172
176
|
isSendingTestMessage: false,
|
|
173
177
|
currentTab: 1,
|
|
178
|
+
senderDetailsByChannel: {},
|
|
179
|
+
wecrmAccounts: [],
|
|
180
|
+
isLoadingSenderDetails: false,
|
|
181
|
+
orgUnitId: -1,
|
|
174
182
|
};
|
|
175
183
|
|
|
176
184
|
beforeEach(() => {
|
|
177
185
|
jest.clearAllMocks();
|
|
186
|
+
lastSendTestMessageProps = null;
|
|
178
187
|
// Reset all mock function implementations
|
|
179
188
|
Object.values(mockActions).forEach((mockFn) => {
|
|
180
189
|
if (jest.isMockFunction(mockFn)) {
|
|
@@ -183,6 +192,778 @@ describe('CommonTestAndPreview', () => {
|
|
|
183
192
|
});
|
|
184
193
|
});
|
|
185
194
|
|
|
195
|
+
describe('Delivery settings / sender ID', () => {
|
|
196
|
+
it('should call getSenderDetailsRequested when show and channel is SMS', async () => {
|
|
197
|
+
render(
|
|
198
|
+
<TestWrapper>
|
|
199
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.SMS} />
|
|
200
|
+
</TestWrapper>
|
|
201
|
+
);
|
|
202
|
+
await waitFor(() => {
|
|
203
|
+
expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
|
|
204
|
+
channel: CHANNELS.SMS,
|
|
205
|
+
orgUnitId: -1,
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should call getSenderDetailsRequested when show and channel is EMAIL', async () => {
|
|
211
|
+
render(
|
|
212
|
+
<TestWrapper>
|
|
213
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.EMAIL} />
|
|
214
|
+
</TestWrapper>
|
|
215
|
+
);
|
|
216
|
+
await waitFor(() => {
|
|
217
|
+
expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
|
|
218
|
+
channel: CHANNELS.EMAIL,
|
|
219
|
+
orgUnitId: -1,
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('should call getSenderDetailsRequested and getWeCrmAccountsRequested when show and channel is WHATSAPP', async () => {
|
|
225
|
+
render(
|
|
226
|
+
<TestWrapper>
|
|
227
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.WHATSAPP} />
|
|
228
|
+
</TestWrapper>
|
|
229
|
+
);
|
|
230
|
+
await waitFor(() => {
|
|
231
|
+
expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
|
|
232
|
+
channel: CHANNELS.WHATSAPP,
|
|
233
|
+
orgUnitId: -1,
|
|
234
|
+
});
|
|
235
|
+
expect(mockActions.getWeCrmAccountsRequested).toHaveBeenCalledWith({
|
|
236
|
+
sourceName: CHANNELS.WHATSAPP,
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('should not call getSenderDetailsRequested when channel is INAPP', async () => {
|
|
242
|
+
render(
|
|
243
|
+
<TestWrapper>
|
|
244
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.INAPP} />
|
|
245
|
+
</TestWrapper>
|
|
246
|
+
);
|
|
247
|
+
await waitFor(() => {
|
|
248
|
+
expect(screen.getByTestId('left-panel')).toBeTruthy();
|
|
249
|
+
});
|
|
250
|
+
expect(mockActions.getSenderDetailsRequested).not.toHaveBeenCalled();
|
|
251
|
+
expect(mockActions.getWeCrmAccountsRequested).not.toHaveBeenCalled();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it('should pass orgUnitId to getSenderDetailsRequested when provided', async () => {
|
|
255
|
+
render(
|
|
256
|
+
<TestWrapper>
|
|
257
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.SMS} orgUnitId={100} />
|
|
258
|
+
</TestWrapper>
|
|
259
|
+
);
|
|
260
|
+
await waitFor(() => {
|
|
261
|
+
expect(mockActions.getSenderDetailsRequested).toHaveBeenCalledWith({
|
|
262
|
+
channel: CHANNELS.SMS,
|
|
263
|
+
orgUnitId: 100,
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it('should not call getSenderDetailsRequested when show is false', async () => {
|
|
269
|
+
render(
|
|
270
|
+
<TestWrapper>
|
|
271
|
+
<CommonTestAndPreview {...defaultProps} show={false} channel={CHANNELS.SMS} />
|
|
272
|
+
</TestWrapper>
|
|
273
|
+
);
|
|
274
|
+
await waitFor(() => {
|
|
275
|
+
expect(screen.queryByTestId('left-panel')).toBeNull();
|
|
276
|
+
});
|
|
277
|
+
expect(mockActions.getSenderDetailsRequested).not.toHaveBeenCalled();
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('should pass delivery-related props to SendTestMessage for SMS channel', async () => {
|
|
281
|
+
const senderDetailsByChannel = {
|
|
282
|
+
[CHANNELS.SMS]: [{ domainId: 1, domainName: 'SMS Dom', gsmSenders: [], cdmaSenders: [] }],
|
|
283
|
+
};
|
|
284
|
+
render(
|
|
285
|
+
<TestWrapper>
|
|
286
|
+
<CommonTestAndPreview
|
|
287
|
+
{...defaultProps}
|
|
288
|
+
channel={CHANNELS.SMS}
|
|
289
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
290
|
+
wecrmAccounts={[]}
|
|
291
|
+
/>
|
|
292
|
+
</TestWrapper>
|
|
293
|
+
);
|
|
294
|
+
await waitFor(() => {
|
|
295
|
+
expect(screen.getByTestId('send-test-message')).toBeTruthy();
|
|
296
|
+
});
|
|
297
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
298
|
+
expect(lastSendTestMessageProps.deliverySettings).toBeDefined();
|
|
299
|
+
expect(lastSendTestMessageProps.senderDetailsOptions).toEqual(senderDetailsByChannel[CHANNELS.SMS]);
|
|
300
|
+
expect(lastSendTestMessageProps.wecrmAccounts).toEqual([]);
|
|
301
|
+
expect(typeof lastSendTestMessageProps.onSaveDeliverySettings).toBe('function');
|
|
302
|
+
expect(lastSendTestMessageProps.isLoadingSenderDetails).toBe(false);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('should pass formDataForSendTest (formData when provided) to SendTestMessage', async () => {
|
|
306
|
+
render(
|
|
307
|
+
<TestWrapper>
|
|
308
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.EMAIL} />
|
|
309
|
+
</TestWrapper>
|
|
310
|
+
);
|
|
311
|
+
await waitFor(() => {
|
|
312
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
313
|
+
});
|
|
314
|
+
expect(lastSendTestMessageProps.formData).toEqual(defaultProps.formData);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('should auto-set SMS delivery settings from TRAI registered sender IDs when DLT is enabled', async () => {
|
|
318
|
+
const senderDetailsByChannel = {
|
|
319
|
+
[CHANNELS.SMS]: [
|
|
320
|
+
{
|
|
321
|
+
domainId: 1,
|
|
322
|
+
dgmId: 11,
|
|
323
|
+
gsmSenders: [{ value: 'SENDER_A' }],
|
|
324
|
+
cdmaSenders: [{ value: 'CDMA_A' }],
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
domainId: 2,
|
|
328
|
+
dgmId: 22,
|
|
329
|
+
gsmSenders: [{ value: 'SENDER_B' }, { value: 'SENDER_C' }],
|
|
330
|
+
cdmaSenders: [{ value: 'CDMA_B' }],
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
render(
|
|
336
|
+
<TestWrapper>
|
|
337
|
+
<CommonTestAndPreview
|
|
338
|
+
{...defaultProps}
|
|
339
|
+
channel={CHANNELS.SMS}
|
|
340
|
+
formData={{
|
|
341
|
+
templateConfigs: {
|
|
342
|
+
traiDltEnabled: true,
|
|
343
|
+
registeredSenderIds: ['SENDER_B'],
|
|
344
|
+
},
|
|
345
|
+
}}
|
|
346
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
347
|
+
/>
|
|
348
|
+
</TestWrapper>
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
await waitFor(() => {
|
|
352
|
+
expect(lastSendTestMessageProps.deliverySettings).toEqual({
|
|
353
|
+
domainId: 2,
|
|
354
|
+
domainGatewayMapId: 22,
|
|
355
|
+
gsmSenderId: 'SENDER_B',
|
|
356
|
+
cdmaSenderId: 'CDMA_B',
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('should preserve existing SMS auto-set logic when TRAI DLT is not enabled', async () => {
|
|
362
|
+
const senderDetailsByChannel = {
|
|
363
|
+
[CHANNELS.SMS]: [
|
|
364
|
+
{
|
|
365
|
+
domainId: 1,
|
|
366
|
+
dgmId: 11,
|
|
367
|
+
gsmSenders: [{ value: 'SENDER_A' }, { value: 'SENDER_A_DEFAULT', default: true }],
|
|
368
|
+
cdmaSenders: [{ value: 'CDMA_A', default: true }],
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
domainId: 2,
|
|
372
|
+
dgmId: 22,
|
|
373
|
+
gsmSenders: [{ value: 'SENDER_B' }],
|
|
374
|
+
cdmaSenders: [{ value: 'CDMA_B' }],
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
render(
|
|
380
|
+
<TestWrapper>
|
|
381
|
+
<CommonTestAndPreview
|
|
382
|
+
{...defaultProps}
|
|
383
|
+
channel={CHANNELS.SMS}
|
|
384
|
+
formData={{
|
|
385
|
+
templateConfigs: {
|
|
386
|
+
traiDltEnabled: false,
|
|
387
|
+
registeredSenderIds: ['SENDER_B'],
|
|
388
|
+
},
|
|
389
|
+
}}
|
|
390
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
391
|
+
/>
|
|
392
|
+
</TestWrapper>
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
await waitFor(() => {
|
|
396
|
+
expect(lastSendTestMessageProps.deliverySettings).toEqual({
|
|
397
|
+
domainId: 1,
|
|
398
|
+
domainGatewayMapId: 11,
|
|
399
|
+
gsmSenderId: 'SENDER_A_DEFAULT',
|
|
400
|
+
cdmaSenderId: 'CDMA_A',
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
it('should keep SMS delivery settings empty when DLT is enabled and no registered sender ID matches', async () => {
|
|
406
|
+
const senderDetailsByChannel = {
|
|
407
|
+
[CHANNELS.SMS]: [
|
|
408
|
+
{
|
|
409
|
+
domainId: 1,
|
|
410
|
+
dgmId: 11,
|
|
411
|
+
gsmSenders: [{ value: 'SENDER_A' }],
|
|
412
|
+
cdmaSenders: [{ value: 'CDMA_A' }],
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
render(
|
|
418
|
+
<TestWrapper>
|
|
419
|
+
<CommonTestAndPreview
|
|
420
|
+
{...defaultProps}
|
|
421
|
+
channel={CHANNELS.SMS}
|
|
422
|
+
formData={{
|
|
423
|
+
templateConfigs: {
|
|
424
|
+
traiDltEnabled: true,
|
|
425
|
+
registeredSenderIds: ['SENDER_X'],
|
|
426
|
+
},
|
|
427
|
+
}}
|
|
428
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
429
|
+
/>
|
|
430
|
+
</TestWrapper>
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
await waitFor(() => {
|
|
434
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
expect(lastSendTestMessageProps.deliverySettings).toEqual({
|
|
438
|
+
domainId: null,
|
|
439
|
+
domainGatewayMapId: null,
|
|
440
|
+
gsmSenderId: '',
|
|
441
|
+
cdmaSenderId: '',
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
it('should auto-set WhatsApp delivery settings from formData accountName when matching account exists', async () => {
|
|
446
|
+
const senderDetailsByChannel = {
|
|
447
|
+
[CHANNELS.WHATSAPP]: [
|
|
448
|
+
{
|
|
449
|
+
domainId: 1,
|
|
450
|
+
sourceAccountIdentifier: 'waba-1',
|
|
451
|
+
gsmSenders: [{ value: '+1111111111' }],
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
domainId: 2,
|
|
455
|
+
sourceAccountIdentifier: 'waba-2',
|
|
456
|
+
gsmSenders: [{ value: '+2222222222' }],
|
|
457
|
+
},
|
|
458
|
+
],
|
|
459
|
+
};
|
|
460
|
+
const wecrmAccounts = [
|
|
461
|
+
{ name: 'Account One', sourceAccountIdentifier: 'waba-1' },
|
|
462
|
+
{ name: 'Account Two', sourceAccountIdentifier: 'waba-2' },
|
|
463
|
+
];
|
|
464
|
+
|
|
465
|
+
render(
|
|
466
|
+
<TestWrapper>
|
|
467
|
+
<CommonTestAndPreview
|
|
468
|
+
{...defaultProps}
|
|
469
|
+
channel={CHANNELS.WHATSAPP}
|
|
470
|
+
formData={{ accountName: 'Account Two', templateMsg: 'WhatsApp test' }}
|
|
471
|
+
senderDetailsByChannel={senderDetailsByChannel}
|
|
472
|
+
wecrmAccounts={wecrmAccounts}
|
|
473
|
+
/>
|
|
474
|
+
</TestWrapper>
|
|
475
|
+
);
|
|
476
|
+
|
|
477
|
+
await waitFor(() => {
|
|
478
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
479
|
+
expect(lastSendTestMessageProps.deliverySettings).toEqual({
|
|
480
|
+
domainId: 2,
|
|
481
|
+
senderMobNum: '+2222222222',
|
|
482
|
+
sourceAccountIdentifier: 'waba-2',
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
it('should include delivery settings in payload when handleSendTestMessage is called for EMAIL', async () => {
|
|
488
|
+
render(
|
|
489
|
+
<TestWrapper>
|
|
490
|
+
<CommonTestAndPreview {...defaultProps} channel={CHANNELS.EMAIL} />
|
|
491
|
+
</TestWrapper>
|
|
492
|
+
);
|
|
493
|
+
await waitFor(() => {
|
|
494
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
495
|
+
expect(typeof lastSendTestMessageProps.handleSendTestMessage).toBe('function');
|
|
496
|
+
});
|
|
497
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
498
|
+
expect(mockActions.createMessageMetaRequested).toHaveBeenCalled();
|
|
499
|
+
const [initialPayload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
500
|
+
expect(initialPayload.emailDeliverySettings).toBeDefined();
|
|
501
|
+
expect(initialPayload.emailDeliverySettings.channelSettings).toBeDefined();
|
|
502
|
+
expect(initialPayload.emailDeliverySettings.channelSettings.channel).toBe(CHANNELS.EMAIL);
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it('should include delivery settings in payload when handleSendTestMessage is called for SMS', async () => {
|
|
506
|
+
render(
|
|
507
|
+
<TestWrapper>
|
|
508
|
+
<CommonTestAndPreview
|
|
509
|
+
{...defaultProps}
|
|
510
|
+
channel={CHANNELS.SMS}
|
|
511
|
+
formData={{ 'sms-editor': 'Test SMS' }}
|
|
512
|
+
/>
|
|
513
|
+
</TestWrapper>
|
|
514
|
+
);
|
|
515
|
+
await waitFor(() => {
|
|
516
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
517
|
+
});
|
|
518
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
519
|
+
expect(mockActions.createMessageMetaRequested).toHaveBeenCalled();
|
|
520
|
+
const [initialPayload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
521
|
+
expect(initialPayload.smsDeliverySettings).toBeDefined();
|
|
522
|
+
expect(initialPayload.smsDeliverySettings.channelSettings).toBeDefined();
|
|
523
|
+
expect(initialPayload.smsDeliverySettings.channelSettings.channel).toBe(CHANNELS.SMS);
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
describe('Carousel payload (getCarouselMappedData) - handleSendTestMessage', () => {
|
|
528
|
+
it('should map empty carouselData to empty cards when mediaType is CAROUSEL', async () => {
|
|
529
|
+
const props = {
|
|
530
|
+
...defaultProps,
|
|
531
|
+
channel: CHANNELS.WHATSAPP,
|
|
532
|
+
formData: {
|
|
533
|
+
templateMsg: 'Message',
|
|
534
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
535
|
+
carouselData: [],
|
|
536
|
+
},
|
|
537
|
+
};
|
|
538
|
+
render(
|
|
539
|
+
<TestWrapper>
|
|
540
|
+
<CommonTestAndPreview {...props} />
|
|
541
|
+
</TestWrapper>
|
|
542
|
+
);
|
|
543
|
+
await waitFor(() => {
|
|
544
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
545
|
+
expect(typeof lastSendTestMessageProps.handleSendTestMessage).toBe('function');
|
|
546
|
+
});
|
|
547
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
548
|
+
expect(mockActions.createMessageMetaRequested).toHaveBeenCalled();
|
|
549
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
550
|
+
expect(payload.whatsappMessageContent.templateConfigs.cards).toEqual([]);
|
|
551
|
+
expect(payload.whatsappMessageContent.templateConfigs.mediaType).toBe('IMAGE');
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
it('should map carousel with IMAGE media and bodyText to cards with media.url', async () => {
|
|
555
|
+
const props = {
|
|
556
|
+
...defaultProps,
|
|
557
|
+
channel: CHANNELS.WHATSAPP,
|
|
558
|
+
formData: {
|
|
559
|
+
templateMsg: 'Message',
|
|
560
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
561
|
+
carouselMediaType: 'IMAGE',
|
|
562
|
+
carouselData: [
|
|
563
|
+
{
|
|
564
|
+
bodyText: 'Card body',
|
|
565
|
+
imageUrl: 'https://image.example.com/1.jpg',
|
|
566
|
+
mediaType: 'image',
|
|
567
|
+
buttons: [],
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
},
|
|
571
|
+
};
|
|
572
|
+
render(
|
|
573
|
+
<TestWrapper>
|
|
574
|
+
<CommonTestAndPreview {...props} />
|
|
575
|
+
</TestWrapper>
|
|
576
|
+
);
|
|
577
|
+
await waitFor(() => {
|
|
578
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
579
|
+
});
|
|
580
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
581
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
582
|
+
const cards = payload.whatsappMessageContent.templateConfigs.cards;
|
|
583
|
+
expect(cards).toHaveLength(1);
|
|
584
|
+
expect(cards[0].body).toBe('Card body');
|
|
585
|
+
expect(cards[0].media).toEqual({ url: 'https://image.example.com/1.jpg' });
|
|
586
|
+
expect(cards[0].mediaType).toBe('IMAGE');
|
|
587
|
+
expect(cards[0].buttons).toEqual([]);
|
|
588
|
+
expect(payload.whatsappMessageContent.templateConfigs.mediaType).toBe('IMAGE');
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
it('should map carousel with VIDEO media to cards with url and previewUrl', async () => {
|
|
592
|
+
const props = {
|
|
593
|
+
...defaultProps,
|
|
594
|
+
channel: CHANNELS.WHATSAPP,
|
|
595
|
+
formData: {
|
|
596
|
+
templateMsg: 'Message',
|
|
597
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
598
|
+
carouselMediaType: 'VIDEO',
|
|
599
|
+
carouselData: [
|
|
600
|
+
{
|
|
601
|
+
bodyText: 'Video card',
|
|
602
|
+
videoUrl: 'https://video.example.com/1.mp4',
|
|
603
|
+
videoPreviewImg: 'https://preview.example.com/1.jpg',
|
|
604
|
+
mediaType: 'video',
|
|
605
|
+
buttons: [],
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
},
|
|
609
|
+
};
|
|
610
|
+
render(
|
|
611
|
+
<TestWrapper>
|
|
612
|
+
<CommonTestAndPreview {...props} />
|
|
613
|
+
</TestWrapper>
|
|
614
|
+
);
|
|
615
|
+
await waitFor(() => {
|
|
616
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
617
|
+
});
|
|
618
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
619
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
620
|
+
const cards = payload.whatsappMessageContent.templateConfigs.cards;
|
|
621
|
+
expect(cards).toHaveLength(1);
|
|
622
|
+
expect(cards[0].body).toBe('Video card');
|
|
623
|
+
expect(cards[0].media).toEqual({
|
|
624
|
+
url: 'https://video.example.com/1.mp4',
|
|
625
|
+
previewUrl: 'https://preview.example.com/1.jpg',
|
|
626
|
+
});
|
|
627
|
+
expect(cards[0].mediaType).toBe('VIDEO');
|
|
628
|
+
expect(payload.whatsappMessageContent.templateConfigs.mediaType).toBe('VIDEO');
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
it('should map button type PHONE_NUMBER to buttonObj with phoneNumber', async () => {
|
|
632
|
+
const props = {
|
|
633
|
+
...defaultProps,
|
|
634
|
+
channel: CHANNELS.WHATSAPP,
|
|
635
|
+
formData: {
|
|
636
|
+
templateMsg: 'Message',
|
|
637
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
638
|
+
carouselData: [
|
|
639
|
+
{
|
|
640
|
+
bodyText: 'Card',
|
|
641
|
+
mediaType: 'image',
|
|
642
|
+
imageUrl: 'https://img.url',
|
|
643
|
+
buttons: [
|
|
644
|
+
{ type: 'PHONE_NUMBER', text: 'Call', phone_number: '+1234567890' },
|
|
645
|
+
],
|
|
646
|
+
},
|
|
647
|
+
],
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
render(
|
|
651
|
+
<TestWrapper>
|
|
652
|
+
<CommonTestAndPreview {...props} />
|
|
653
|
+
</TestWrapper>
|
|
654
|
+
);
|
|
655
|
+
await waitFor(() => {
|
|
656
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
657
|
+
});
|
|
658
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
659
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
660
|
+
const buttons = payload.whatsappMessageContent.templateConfigs.cards[0].buttons;
|
|
661
|
+
expect(buttons).toHaveLength(1);
|
|
662
|
+
expect(buttons[0].type).toBe('PHONE_NUMBER');
|
|
663
|
+
expect(buttons[0].text).toBe('Call');
|
|
664
|
+
expect(buttons[0].index).toBe(0);
|
|
665
|
+
expect(buttons[0].phoneNumber).toBe('+1234567890');
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
it('should map button type URL without DYNAMIC_URL to buttonObj with url only', async () => {
|
|
669
|
+
const props = {
|
|
670
|
+
...defaultProps,
|
|
671
|
+
channel: CHANNELS.WHATSAPP,
|
|
672
|
+
formData: {
|
|
673
|
+
templateMsg: 'Message',
|
|
674
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
675
|
+
carouselData: [
|
|
676
|
+
{
|
|
677
|
+
bodyText: 'Card',
|
|
678
|
+
mediaType: 'image',
|
|
679
|
+
imageUrl: 'https://img.url',
|
|
680
|
+
buttons: [
|
|
681
|
+
{ type: 'URL', text: 'Open', urlType: 'STATIC', url: 'https://example.com' },
|
|
682
|
+
],
|
|
683
|
+
},
|
|
684
|
+
],
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
render(
|
|
688
|
+
<TestWrapper>
|
|
689
|
+
<CommonTestAndPreview {...props} />
|
|
690
|
+
</TestWrapper>
|
|
691
|
+
);
|
|
692
|
+
await waitFor(() => {
|
|
693
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
694
|
+
});
|
|
695
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
696
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
697
|
+
const buttons = payload.whatsappMessageContent.templateConfigs.cards[0].buttons;
|
|
698
|
+
expect(buttons[0].type).toBe('URL');
|
|
699
|
+
expect(buttons[0].url).toBe('https://example.com');
|
|
700
|
+
expect(buttons[0].dynamicUrlPayload).toBeUndefined();
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
it('should set dynamicUrlPayload when button type URL and urlType DYNAMIC_URL with single template', async () => {
|
|
704
|
+
const props = {
|
|
705
|
+
...defaultProps,
|
|
706
|
+
channel: CHANNELS.WHATSAPP,
|
|
707
|
+
formData: {
|
|
708
|
+
templateMsg: 'Message',
|
|
709
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
710
|
+
carouselData: [
|
|
711
|
+
{
|
|
712
|
+
bodyText: 'Card',
|
|
713
|
+
mediaType: 'image',
|
|
714
|
+
imageUrl: 'https://img.url',
|
|
715
|
+
buttons: [
|
|
716
|
+
{ type: 'URL', text: 'Open', urlType: 'DYNAMIC_URL', url: 'https://example.com/{{id}}' },
|
|
717
|
+
],
|
|
718
|
+
},
|
|
719
|
+
],
|
|
720
|
+
},
|
|
721
|
+
};
|
|
722
|
+
render(
|
|
723
|
+
<TestWrapper>
|
|
724
|
+
<CommonTestAndPreview {...props} />
|
|
725
|
+
</TestWrapper>
|
|
726
|
+
);
|
|
727
|
+
await waitFor(() => {
|
|
728
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
729
|
+
});
|
|
730
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
731
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
732
|
+
const buttons = payload.whatsappMessageContent.templateConfigs.cards[0].buttons;
|
|
733
|
+
expect(buttons[0].url).toBe('https://example.com/{{id}}');
|
|
734
|
+
expect(buttons[0].dynamicUrlPayload).toBe('{{id}}');
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
it('should set dynamicUrlPayload to empty when urlType DYNAMIC_URL but multiple or zero matches', async () => {
|
|
738
|
+
const props = {
|
|
739
|
+
...defaultProps,
|
|
740
|
+
channel: CHANNELS.WHATSAPP,
|
|
741
|
+
formData: {
|
|
742
|
+
templateMsg: 'Message',
|
|
743
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
744
|
+
carouselData: [
|
|
745
|
+
{
|
|
746
|
+
bodyText: 'Card',
|
|
747
|
+
mediaType: 'image',
|
|
748
|
+
imageUrl: 'https://img.url',
|
|
749
|
+
buttons: [
|
|
750
|
+
{ type: 'URL', text: 'Open', urlType: 'DYNAMIC_URL', url: 'https://example.com/{{a}}{{b}}' },
|
|
751
|
+
],
|
|
752
|
+
},
|
|
753
|
+
],
|
|
754
|
+
},
|
|
755
|
+
};
|
|
756
|
+
render(
|
|
757
|
+
<TestWrapper>
|
|
758
|
+
<CommonTestAndPreview {...props} />
|
|
759
|
+
</TestWrapper>
|
|
760
|
+
);
|
|
761
|
+
await waitFor(() => {
|
|
762
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
763
|
+
});
|
|
764
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
765
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
766
|
+
const buttons = payload.whatsappMessageContent.templateConfigs.cards[0].buttons;
|
|
767
|
+
expect(buttons[0].dynamicUrlPayload).toBe('');
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
it('should set dynamicUrlPayload to empty when urlType DYNAMIC_URL and url is null/undefined', async () => {
|
|
771
|
+
const props = {
|
|
772
|
+
...defaultProps,
|
|
773
|
+
channel: CHANNELS.WHATSAPP,
|
|
774
|
+
formData: {
|
|
775
|
+
templateMsg: 'Message',
|
|
776
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
777
|
+
carouselData: [
|
|
778
|
+
{
|
|
779
|
+
bodyText: 'Card',
|
|
780
|
+
mediaType: 'image',
|
|
781
|
+
imageUrl: 'https://img.url',
|
|
782
|
+
buttons: [
|
|
783
|
+
{ type: 'URL', text: 'Open', urlType: 'DYNAMIC_URL', url: null },
|
|
784
|
+
],
|
|
785
|
+
},
|
|
786
|
+
],
|
|
787
|
+
},
|
|
788
|
+
};
|
|
789
|
+
render(
|
|
790
|
+
<TestWrapper>
|
|
791
|
+
<CommonTestAndPreview {...props} />
|
|
792
|
+
</TestWrapper>
|
|
793
|
+
);
|
|
794
|
+
await waitFor(() => {
|
|
795
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
796
|
+
});
|
|
797
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
798
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
799
|
+
const buttons = payload.whatsappMessageContent.templateConfigs.cards[0].buttons;
|
|
800
|
+
expect(buttons[0].dynamicUrlPayload).toBe('');
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
it('should pass through cardVarMapped and bodyTemplate on each card', async () => {
|
|
804
|
+
const props = {
|
|
805
|
+
...defaultProps,
|
|
806
|
+
channel: CHANNELS.WHATSAPP,
|
|
807
|
+
formData: {
|
|
808
|
+
templateMsg: 'Message',
|
|
809
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
810
|
+
carouselData: [
|
|
811
|
+
{
|
|
812
|
+
bodyText: 'Body',
|
|
813
|
+
cardVarMapped: { foo: 'bar' },
|
|
814
|
+
bodyTemplate: 'Body {{foo}}',
|
|
815
|
+
mediaType: 'image',
|
|
816
|
+
imageUrl: 'https://img.url',
|
|
817
|
+
buttons: [],
|
|
818
|
+
},
|
|
819
|
+
],
|
|
820
|
+
},
|
|
821
|
+
};
|
|
822
|
+
render(
|
|
823
|
+
<TestWrapper>
|
|
824
|
+
<CommonTestAndPreview {...props} />
|
|
825
|
+
</TestWrapper>
|
|
826
|
+
);
|
|
827
|
+
await waitFor(() => {
|
|
828
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
829
|
+
});
|
|
830
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
831
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
832
|
+
const card = payload.whatsappMessageContent.templateConfigs.cards[0];
|
|
833
|
+
expect(card.cardVarMapped).toEqual({ foo: 'bar' });
|
|
834
|
+
expect(card.bodyTemplate).toBe('Body {{foo}}');
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
it('should not add media url when mediaType is neither image nor video', async () => {
|
|
838
|
+
const props = {
|
|
839
|
+
...defaultProps,
|
|
840
|
+
channel: CHANNELS.WHATSAPP,
|
|
841
|
+
formData: {
|
|
842
|
+
templateMsg: 'Message',
|
|
843
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
844
|
+
carouselData: [
|
|
845
|
+
{
|
|
846
|
+
bodyText: 'Card',
|
|
847
|
+
mediaType: 'DOCUMENT',
|
|
848
|
+
imageUrl: 'https://img.url',
|
|
849
|
+
videoUrl: 'https://video.url',
|
|
850
|
+
buttons: [],
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
},
|
|
854
|
+
};
|
|
855
|
+
render(
|
|
856
|
+
<TestWrapper>
|
|
857
|
+
<CommonTestAndPreview {...props} />
|
|
858
|
+
</TestWrapper>
|
|
859
|
+
);
|
|
860
|
+
await waitFor(() => {
|
|
861
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
862
|
+
});
|
|
863
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
864
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
865
|
+
const card = payload.whatsappMessageContent.templateConfigs.cards[0];
|
|
866
|
+
expect(card.media).toEqual({});
|
|
867
|
+
expect(card.mediaType).toBe('DOCUMENT');
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
it('should handle multiple carousel cards with mixed button types', async () => {
|
|
871
|
+
const props = {
|
|
872
|
+
...defaultProps,
|
|
873
|
+
channel: CHANNELS.WHATSAPP,
|
|
874
|
+
formData: {
|
|
875
|
+
templateMsg: 'Message',
|
|
876
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
877
|
+
carouselData: [
|
|
878
|
+
{
|
|
879
|
+
bodyText: 'First',
|
|
880
|
+
mediaType: 'image',
|
|
881
|
+
imageUrl: 'https://first.jpg',
|
|
882
|
+
buttons: [{ type: 'PHONE_NUMBER', text: 'Call', phone_number: '+111' }],
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
bodyText: 'Second',
|
|
886
|
+
mediaType: 'video',
|
|
887
|
+
videoUrl: 'https://second.mp4',
|
|
888
|
+
videoPreviewImg: 'https://second-prev.jpg',
|
|
889
|
+
buttons: [{ type: 'URL', text: 'Link', urlType: 'DYNAMIC_URL', url: 'https://x/{{only}}' }],
|
|
890
|
+
},
|
|
891
|
+
],
|
|
892
|
+
},
|
|
893
|
+
};
|
|
894
|
+
render(
|
|
895
|
+
<TestWrapper>
|
|
896
|
+
<CommonTestAndPreview {...props} />
|
|
897
|
+
</TestWrapper>
|
|
898
|
+
);
|
|
899
|
+
await waitFor(() => {
|
|
900
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
901
|
+
});
|
|
902
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
903
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
904
|
+
const cards = payload.whatsappMessageContent.templateConfigs.cards;
|
|
905
|
+
expect(cards).toHaveLength(2);
|
|
906
|
+
expect(cards[0].body).toBe('First');
|
|
907
|
+
expect(cards[0].media.url).toBe('https://first.jpg');
|
|
908
|
+
expect(cards[0].buttons[0].phoneNumber).toBe('+111');
|
|
909
|
+
expect(cards[1].body).toBe('Second');
|
|
910
|
+
expect(cards[1].media.url).toBe('https://second.mp4');
|
|
911
|
+
expect(cards[1].media.previewUrl).toBe('https://second-prev.jpg');
|
|
912
|
+
expect(cards[1].buttons[0].dynamicUrlPayload).toBe('{{only}}');
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
it('should use carouselMediaType for templateConfigs.mediaType when provided', async () => {
|
|
916
|
+
const props = {
|
|
917
|
+
...defaultProps,
|
|
918
|
+
channel: CHANNELS.WHATSAPP,
|
|
919
|
+
formData: {
|
|
920
|
+
templateMsg: 'Message',
|
|
921
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
922
|
+
carouselMediaType: 'VIDEO',
|
|
923
|
+
carouselData: [
|
|
924
|
+
{ bodyText: 'Card', mediaType: 'image', imageUrl: 'https://img.url', buttons: [] },
|
|
925
|
+
],
|
|
926
|
+
},
|
|
927
|
+
};
|
|
928
|
+
render(
|
|
929
|
+
<TestWrapper>
|
|
930
|
+
<CommonTestAndPreview {...props} />
|
|
931
|
+
</TestWrapper>
|
|
932
|
+
);
|
|
933
|
+
await waitFor(() => {
|
|
934
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
935
|
+
});
|
|
936
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
937
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
938
|
+
expect(payload.whatsappMessageContent.templateConfigs.mediaType).toBe('VIDEO');
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
it('should default templateConfigs.mediaType to IMAGE when carouselMediaType is missing', async () => {
|
|
942
|
+
const props = {
|
|
943
|
+
...defaultProps,
|
|
944
|
+
channel: CHANNELS.WHATSAPP,
|
|
945
|
+
formData: {
|
|
946
|
+
templateMsg: 'Message',
|
|
947
|
+
mediaType: MEDIA_TYPE_CAROUSEL,
|
|
948
|
+
carouselData: [
|
|
949
|
+
{ bodyText: 'Card', mediaType: 'image', imageUrl: 'https://img.url', buttons: [] },
|
|
950
|
+
],
|
|
951
|
+
},
|
|
952
|
+
};
|
|
953
|
+
render(
|
|
954
|
+
<TestWrapper>
|
|
955
|
+
<CommonTestAndPreview {...props} />
|
|
956
|
+
</TestWrapper>
|
|
957
|
+
);
|
|
958
|
+
await waitFor(() => {
|
|
959
|
+
expect(lastSendTestMessageProps).toBeDefined();
|
|
960
|
+
});
|
|
961
|
+
lastSendTestMessageProps.handleSendTestMessage();
|
|
962
|
+
const [payload] = mockActions.createMessageMetaRequested.mock.calls[0];
|
|
963
|
+
expect(payload.whatsappMessageContent.templateConfigs.mediaType).toBe('IMAGE');
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
|
|
186
967
|
describe('Component Rendering', () => {
|
|
187
968
|
it('should render when show is true', async () => {
|
|
188
969
|
render(
|