@capillarytech/creatives-library 7.14.29 → 7.14.31
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/services/api.js +2 -2
- package/services/tests/api.test.js +28 -13
- package/services/tests/mockData.js +46 -0
- package/v2Components/CapWhatsappCTA/tests/index.test.js +16 -0
- package/v2Containers/Whatsapp/actions.js +2 -2
- package/v2Containers/Whatsapp/index.js +5 -4
- package/v2Containers/Whatsapp/sagas.js +2 -2
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +15443 -3050
- package/v2Containers/Whatsapp/tests/actions.test.js +41 -0
- package/v2Containers/Whatsapp/tests/index.test.js +6 -3
- package/v2Containers/Whatsapp/tests/mockData.js +8 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as types from '../constants';
|
|
2
|
+
import * as actions from '../actions';
|
|
3
|
+
|
|
4
|
+
describe('Test whatsapp actions', () => {
|
|
5
|
+
it('has a type of TEMPLATE_CREATE_REQUEST action', () => {
|
|
6
|
+
const payload = {
|
|
7
|
+
name: 'template_name',
|
|
8
|
+
versions: {
|
|
9
|
+
base: {
|
|
10
|
+
content: {
|
|
11
|
+
whatsapp: {
|
|
12
|
+
category: 'TRANSACTIONAL',
|
|
13
|
+
languages: [
|
|
14
|
+
{
|
|
15
|
+
language: 'en',
|
|
16
|
+
content: 'gupshup template message',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
mediaType: 'TEXT',
|
|
20
|
+
varMapped: {},
|
|
21
|
+
templateEditor: false,
|
|
22
|
+
accountId: '2000222347',
|
|
23
|
+
accessToken: 'DTpZEh4VK',
|
|
24
|
+
hostName: 'gupshupwhatsappbulk',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
type: 'WHATSAPP',
|
|
30
|
+
};
|
|
31
|
+
const expected = {
|
|
32
|
+
type: types.TEMPLATE_CREATE_REQUEST,
|
|
33
|
+
payload,
|
|
34
|
+
callback: undefined,
|
|
35
|
+
gupshupMediaFile: undefined,
|
|
36
|
+
};
|
|
37
|
+
expect(
|
|
38
|
+
actions.createWhatsappTemplate(payload, undefined, undefined),
|
|
39
|
+
).toStrictEqual(expected);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -31,6 +31,7 @@ describe('Creatives Whatsapp test1/>', () => {
|
|
|
31
31
|
const accountData1 = mockData.accountData1;
|
|
32
32
|
const accountData2 = mockData.accountData2;
|
|
33
33
|
const accountData3 = mockData.accountData3;
|
|
34
|
+
const accountData4 = mockData.accountData4;
|
|
34
35
|
|
|
35
36
|
const renderHelper = (args, isFullMode = true, accData = accountData1) => {
|
|
36
37
|
renderedComponent = mountWithIntl(
|
|
@@ -69,6 +70,8 @@ describe('Creatives Whatsapp test1/>', () => {
|
|
|
69
70
|
expect(renderedComponent).toMatchSnapshot();
|
|
70
71
|
renderHelper({}, true, accountData3);
|
|
71
72
|
expect(renderedComponent).toMatchSnapshot();
|
|
73
|
+
renderHelper({}, true, accountData4);
|
|
74
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
72
75
|
renderHelper({}, true, {});
|
|
73
76
|
expect(renderedComponent).toMatchSnapshot();
|
|
74
77
|
});
|
|
@@ -306,7 +309,7 @@ describe('Creatives Whatsapp test2/>', () => {
|
|
|
306
309
|
constants.INITIAL_CTA_DATA = [];
|
|
307
310
|
renderHelper({});
|
|
308
311
|
let event = { target: { value: 'template_name' } };
|
|
309
|
-
createWhatsappTemplate.mockImplementation((
|
|
312
|
+
createWhatsappTemplate.mockImplementation((obj, callback, undefined) => {
|
|
310
313
|
callback();
|
|
311
314
|
});
|
|
312
315
|
|
|
@@ -356,7 +359,7 @@ describe('Creatives Whatsapp test2/>', () => {
|
|
|
356
359
|
];
|
|
357
360
|
renderHelper({});
|
|
358
361
|
let event = { target: { value: 'template_name' } };
|
|
359
|
-
createWhatsappTemplate.mockImplementation((
|
|
362
|
+
createWhatsappTemplate.mockImplementation((obj, callback, undefined) => {
|
|
360
363
|
callback();
|
|
361
364
|
});
|
|
362
365
|
|
|
@@ -416,7 +419,7 @@ describe('Creatives Whatsapp test2/>', () => {
|
|
|
416
419
|
];
|
|
417
420
|
renderHelper({});
|
|
418
421
|
let event = { target: { value: 'template_name' } };
|
|
419
|
-
createWhatsappTemplate.mockImplementation((
|
|
422
|
+
createWhatsappTemplate.mockImplementation((obj, callback, undefined) => {
|
|
420
423
|
callback();
|
|
421
424
|
});
|
|
422
425
|
|
|
@@ -20,6 +20,14 @@ export const mockData = {
|
|
|
20
20
|
test: 'test',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
+
accountData4: {
|
|
24
|
+
selectedWhatsappAccount: {
|
|
25
|
+
name: 'gupshup_test',
|
|
26
|
+
sourceAccountIdentifier: '2000222347',
|
|
27
|
+
configs: { accessToken: 'DTpZEh4VK' },
|
|
28
|
+
hostName: 'gupshupwhatsappbulk',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
23
31
|
editData1: {
|
|
24
32
|
templateDetails: {
|
|
25
33
|
_id: '62034b4683c75608cf2404ec',
|