@capillarytech/creatives-library 7.12.39 → 7.12.41

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.
Files changed (25) hide show
  1. package/package.json +1 -1
  2. package/v2Components/CapWhatsappCTA/constants.js +0 -5
  3. package/v2Components/CapWhatsappCTA/index.js +13 -12
  4. package/v2Components/CapWhatsappCTA/index.scss +15 -0
  5. package/v2Components/CapWhatsappCTA/messages.js +0 -4
  6. package/v2Components/CapWhatsappCTA/tests/index.test.js +152 -0
  7. package/v2Components/TemplatePreview/index.js +5 -6
  8. package/v2Components/TemplatePreview/messages.js +0 -8
  9. package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +190 -27
  10. package/v2Components/TemplatePreview/tests/index.test.js +52 -5
  11. package/v2Containers/CreativesContainer/index.js +7 -2
  12. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +30 -6
  13. package/v2Containers/CreativesContainer/tests/index.test.js +47 -14
  14. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +40 -240
  15. package/v2Containers/Whatsapp/constants.js +10 -7
  16. package/v2Containers/Whatsapp/index.js +100 -61
  17. package/v2Containers/Whatsapp/index.scss +6 -2
  18. package/v2Containers/Whatsapp/messages.js +6 -2
  19. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +94558 -28425
  20. package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +98 -8
  21. package/v2Containers/Whatsapp/tests/index.test.js +159 -18
  22. package/v2Containers/Whatsapp/tests/mockData.js +150 -89
  23. package/v2Containers/Whatsapp/tests/utils.test.js +8 -0
  24. package/v2Containers/Whatsapp/utils.js +49 -48
  25. package/v2Containers/mockdata.js +177 -5
@@ -3,17 +3,47 @@
3
3
  exports[`Test utils test getWhatsappContent 1`] = `
4
4
  Object {
5
5
  "charCount": 46,
6
+ "ctaData": Array [
7
+ Object {
8
+ "index": 0,
9
+ "phone_number": "+919738752617",
10
+ "text": "Call",
11
+ "type": "PHONE_NUMBER",
12
+ },
13
+ Object {
14
+ "index": 1,
15
+ "text": "More info",
16
+ "type": "STATIC_URL",
17
+ "url": "https://fast.com/",
18
+ },
19
+ ],
6
20
  "templateMsg": <React.Fragment>
7
21
  <CapLabel
8
22
  type="label9"
9
23
  >
10
24
  1234567890
11
-
25
+ Click {{unsubscribe}} to unsubscribe
12
26
  </CapLabel>
27
+ </React.Fragment>,
28
+ }
29
+ `;
30
+
31
+ exports[`Test utils test getWhatsappContent 2`] = `
32
+ Object {
33
+ "charCount": 3,
34
+ "ctaData": Array [
35
+ Object {
36
+ "index": 0,
37
+ "phone_number": "",
38
+ "text": "",
39
+ "type": "PHONE_NUMBER",
40
+ },
41
+ ],
42
+ "templateMsg": <React.Fragment>
13
43
  <CapLabel
14
44
  type="label9"
15
45
  >
16
- Click {{unsubscribe}} to unsubscribe
46
+ test
17
47
  </CapLabel>
18
48
  </React.Fragment>,
19
49
  }
@@ -22,18 +52,78 @@ Object {
22
52
  exports[`Test utils test getWhatsappContent for preview 1`] = `
23
53
  Object {
24
54
  "charCount": 46,
55
+ "ctaData": Array [
56
+ Object {
57
+ "index": 0,
58
+ "phone_number": "+919738752617",
59
+ "text": "Call",
60
+ "type": "PHONE_NUMBER",
61
+ },
62
+ Object {
63
+ "index": 1,
64
+ "text": "More info",
65
+ "type": "STATIC_URL",
66
+ "url": "https://fast.com/",
67
+ },
68
+ ],
25
69
  "templateMsg": <React.Fragment>
26
70
  <CapLabel
27
71
  type="label5"
28
72
  >
29
73
  1234567890
30
-
31
- </CapLabel>
32
- <CapLabel
33
- type="label5"
34
- >
35
- Click {{unsubscribe}} to unsubscribe
74
+ Click {{unsubscribe}} to unsubscribe
36
75
  </CapLabel>
37
76
  </React.Fragment>,
38
77
  }
39
78
  `;
79
+
80
+ exports[`Test utils test getWhatsappCta 1`] = `
81
+ Array [
82
+ <CapLabel
83
+ style={
84
+ Object {
85
+ "marginTop": "12px",
86
+ "textAlign": "center",
87
+ }
88
+ }
89
+ type="label21"
90
+ >
91
+ <CapIcon
92
+ size="xs"
93
+ svgProps={
94
+ Object {
95
+ "style": Object {
96
+ "marginRight": "4px",
97
+ },
98
+ }
99
+ }
100
+ type="call"
101
+ />
102
+ Call
103
+ </CapLabel>,
104
+ <CapLabel
105
+ style={
106
+ Object {
107
+ "marginTop": "12px",
108
+ "textAlign": "center",
109
+ }
110
+ }
111
+ type="label21"
112
+ >
113
+ <CapIcon
114
+ size="xs"
115
+ svgProps={
116
+ Object {
117
+ "style": Object {
118
+ "marginRight": "4px",
119
+ },
120
+ }
121
+ }
122
+ type="launch"
123
+ />
124
+ More info
125
+ </CapLabel>,
126
+ ]
127
+ `;
128
+
129
+ exports[`Test utils test getWhatsappCta 2`] = `Array []`;
@@ -11,9 +11,10 @@ beforeAll(() => {
11
11
  store = configureStore({}, browserHistory);
12
12
  });
13
13
 
14
- describe('Creatives Whatsapp test/>', () => {
14
+ describe('Creatives Whatsapp test1/>', () => {
15
15
  let renderedComponent;
16
16
  const createWhatsappTemplate = jest.fn();
17
+ const getFormData = jest.fn();
17
18
  const clearCreateResponse = jest.fn();
18
19
  const getTemplateDetails = jest.fn();
19
20
  const resetEditTemplate = jest.fn();
@@ -28,9 +29,10 @@ describe('Creatives Whatsapp test/>', () => {
28
29
  const editData1 = mockData.editData1;
29
30
  const editData2 = mockData.editData2;
30
31
  const editData3 = mockData.editData3;
32
+ const editdata4 = mockData.editdata4;
31
33
  const accountData = mockData.accountData;
32
34
 
33
- const renderHelper = (args) => {
35
+ const renderHelper = (args,isFullMode = true) => {
34
36
  renderedComponent = mountWithIntl(
35
37
  <Provider store={store}>
36
38
  <Whatsapp
@@ -43,12 +45,14 @@ describe('Creatives Whatsapp test/>', () => {
43
45
  globalActions={{ fetchSchemaForEntity }}
44
46
  onCreateComplete={onCreateComplete}
45
47
  handleClose={handleClose}
48
+ getFormData={getFormData}
46
49
  params={args.params}
47
50
  editData={args.editData}
51
+ templateData={args.templateData}
48
52
  accountData={accountData}
49
53
  location={location}
50
54
  intl={{ formatMessage }}
51
- isFullMode={args.isFullMode || true}
55
+ isFullMode={isFullMode}
52
56
  isEditFlow={args.isEditFlow || false}
53
57
  loadingTags={args.loadingTags}
54
58
  metaEntities={[]}
@@ -56,22 +60,13 @@ describe('Creatives Whatsapp test/>', () => {
56
60
  />
57
61
  </Provider>,
58
62
  );
59
- }
63
+ };
60
64
 
61
65
  it('should render create mode', () => {
62
66
  renderHelper({});
63
67
  expect(renderedComponent).toMatchSnapshot();
64
68
  });
65
69
 
66
- it('test addVariable in create mode', () => {
67
- renderHelper({});
68
- renderedComponent
69
- .find('CapHeader').at(1)
70
- .props().suffix
71
- .props.onClick();
72
- expect(renderedComponent).toMatchSnapshot();
73
- });
74
-
75
70
  it('template name change', () => {
76
71
  renderHelper({});
77
72
  const templateNameRenderHelper = (val) => {
@@ -161,6 +156,30 @@ describe('Creatives Whatsapp test/>', () => {
161
156
  createWhatsappTemplate.mockImplementation((obj, callback) => {
162
157
  callback();
163
158
  });
159
+ const handleClick = jest.spyOn(React, 'useState');
160
+ handleClick.mockImplementation((ctaData) => [
161
+ ctaData,
162
+ [
163
+ {
164
+ index: 0,
165
+ ctaType: 'WEBSITE',
166
+ text: 'Visit',
167
+ phone_number: '',
168
+ urlType: 'STATIC_URL',
169
+ url: 'https://www.google.com',
170
+ isSaved: true,
171
+ },
172
+ {
173
+ index: 1,
174
+ ctaType: 'PHONE_NUMBER',
175
+ text: 'Call us',
176
+ phone_number: '9112345',
177
+ urlType: 'STATIC_URL',
178
+ url: '',
179
+ isSaved: true,
180
+ },
181
+ ],
182
+ ]);
164
183
  renderedComponent
165
184
  .find('#whatsapp_template_name_input')
166
185
  .at(3)
@@ -178,21 +197,143 @@ describe('Creatives Whatsapp test/>', () => {
178
197
  .find('TextArea#whatsapp-create-template-message-input')
179
198
  .at(1)
180
199
  .simulate('change', event);
200
+ event = { target: { checked: true } };
201
+ renderedComponent
202
+ .find('CapCheckbox.whatsapp-unsubscribe-checkbox')
203
+ .props()
204
+ .onChange(event);
205
+ renderedComponent.update();
206
+ event = { target: { value: 'CTA' } };
207
+ renderedComponent
208
+ .find('CapRadioGroup.whatsapp-btn-radio-group')
209
+ .props()
210
+ .onChange(event);
211
+ renderedComponent.update();
181
212
  renderedComponent.find('CapButton.whatsapp-create-btn').props().onClick();
213
+ expect(renderedComponent).toMatchSnapshot();
182
214
  });
183
215
 
184
216
  it('should render edit mode in various cases', () => {
185
217
  let event = { target: { value: '5454', id: '{{1}}_1' } };
186
- renderHelper({ params, editData: editData1, isEditFlow: true, loadingTags: false });
218
+ renderHelper({
219
+ params,
220
+ editData: editData1,
221
+ isEditFlow: true,
222
+ loadingTags: false,
223
+ });
187
224
  expect(renderedComponent).toMatchSnapshot();
188
- renderHelper({ params, editData: editData2, isEditFlow: true, loadingTags: false });
225
+ renderHelper({
226
+ params,
227
+ editData: editData2,
228
+ isEditFlow: true,
229
+ loadingTags: false,
230
+ });
189
231
  expect(renderedComponent).toMatchSnapshot();
190
- renderHelper({ params, editData: editData3, isEditFlow: true, loadingTags: false });
232
+ renderHelper({
233
+ params,
234
+ editData: editData3,
235
+ isEditFlow: true,
236
+ loadingTags: false,
237
+ });
191
238
  expect(renderedComponent).toMatchSnapshot();
192
- renderHelper({ params, editData: editData1, isEditFlow: true, loadingTags: false });
193
- renderedComponent.find('textarea.TextArea__StyledTextArea-sc-177dfyt-2')
239
+ renderHelper({
240
+ params,
241
+ editData: editData1,
242
+ isEditFlow: true,
243
+ loadingTags: false,
244
+ });
245
+ renderedComponent
246
+ .find('textarea.TextArea__StyledTextArea-sc-177dfyt-2')
194
247
  .at(1)
195
248
  .simulate('change', event);
196
249
  expect(renderedComponent).toMatchSnapshot();
250
+ renderHelper({
251
+ params,
252
+ templateData: editdata4,
253
+ isEditFlow: true,
254
+ loadingTags: false,
255
+ },false);
256
+ expect(renderedComponent).toMatchSnapshot();
257
+ renderedComponent.find('CapButton.whatsapp-create-btn').props().onClick();
258
+ });
259
+ });
260
+
261
+ describe('Creatives Whatsapp test2/>', () => {
262
+ let renderedComponent;
263
+ const createWhatsappTemplate = jest.fn();
264
+ const clearCreateResponse = jest.fn();
265
+ const getTemplateDetails = jest.fn();
266
+ const resetEditTemplate = jest.fn();
267
+ const fetchSchemaForEntity = jest.fn();
268
+ const handleClose = jest.fn();
269
+ const onCreateComplete = jest.fn();
270
+ const formatMessage = jest.fn();
271
+ const location = mockData.location;
272
+ const params = {
273
+ id: mockData.editData1.templateDetails._id,
274
+ };
275
+ const editData1 = mockData.editData1;
276
+ const editData2 = mockData.editData2;
277
+ const editData3 = mockData.editData3;
278
+ const editdata4 = mockData.editdata4;
279
+ const accountData = mockData.accountData;
280
+
281
+ const renderHelper = (args,isFullMode = true) => {
282
+ renderedComponent = mountWithIntl(
283
+ <Provider store={store}>
284
+ <Whatsapp
285
+ actions={{
286
+ createWhatsappTemplate,
287
+ clearCreateResponse,
288
+ getTemplateDetails,
289
+ resetEditTemplate,
290
+ }}
291
+ globalActions={{ fetchSchemaForEntity }}
292
+ onCreateComplete={onCreateComplete}
293
+ handleClose={handleClose}
294
+ params={args.params}
295
+ editData={args.editData}
296
+ accountData={accountData}
297
+ location={location}
298
+ intl={{ formatMessage }}
299
+ isFullMode={isFullMode}
300
+ isEditFlow={args.isEditFlow || false}
301
+ loadingTags={args.loadingTags}
302
+ metaEntities={[]}
303
+ getDefaultTags={true}
304
+ />
305
+ </Provider>,
306
+ );
307
+ };
308
+
309
+ it('test addVariable in create mode', () => {
310
+ renderHelper({});
311
+ renderedComponent.find('CapHeader').at(1).props().suffix.props.onClick();
312
+ expect(renderedComponent).toMatchSnapshot();
313
+ });
314
+
315
+ it('add cta', () => {
316
+ renderHelper({});
317
+ let event = { target: { value: 'CTA' } };
318
+ renderedComponent
319
+ .find('CapRadioGroup.whatsapp-btn-radio-group')
320
+ .props()
321
+ .onChange(event);
322
+ expect(renderedComponent).toMatchSnapshot();
323
+ });
324
+ it('check unsubscribe', () => {
325
+ renderHelper({});
326
+ let event = { target: { checked: true } };
327
+ renderedComponent
328
+ .find('CapCheckbox.whatsapp-unsubscribe-checkbox')
329
+ .props()
330
+ .onChange(event);
331
+ renderedComponent.update();
332
+ expect(
333
+ renderedComponent
334
+ .find('CapCheckbox.whatsapp-unsubscribe-checkbox')
335
+ .props().checked,
336
+ ).toBe(true);
337
+ expect(renderedComponent).toMatchSnapshot();
197
338
  });
198
339
  });
@@ -8,114 +8,175 @@ export const mockData = {
8
8
  },
9
9
  editData1: {
10
10
  templateDetails: {
11
- "_id": "62034b4683c75608cf2404ec",
12
- "name": "points_update",
13
- "type": "WHATSAPP",
14
- "versions": {
15
- "history": [],
16
- "base": {
17
- "content": {
18
- "whatsapp": {
19
- "status": "approved",
20
- "templateId": "HT9bb4d61eea1699d2dbcaecd1cb558345",
21
- "accountName": "WhatsppTest",
22
- "accessToken": "4676323eb5d1f975b0987070c03a8efc",
23
- "accountId": "AC41030cebba9e2f1ce37c78235da0ee18",
24
- "mediaType": "text",
25
- "languages": [
11
+ _id: '62034b4683c75608cf2404ec',
12
+ name: 'points_update',
13
+ type: 'WHATSAPP',
14
+ versions: {
15
+ history: [],
16
+ base: {
17
+ content: {
18
+ whatsapp: {
19
+ status: 'approved',
20
+ templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
21
+ accountName: 'WhatsppTest',
22
+ accessToken: '4676323eb5d1f975b0987070c03a8efc',
23
+ accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
24
+ mediaType: 'text',
25
+ languages: [
26
26
  {
27
- "content": "$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C\nClick {{3}} to unsubscribe'",
28
- "language": "en"
29
- }
27
+ content:
28
+ "$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C\nClick {{3}} to unsubscribe'",
29
+ language: 'en',
30
+ },
30
31
  ],
31
- "category": "ACCOUNT_UPDATE",
32
- "rejection_reason": null,
33
- "varMapped": {
32
+ buttonType: 'CTA',
33
+ buttons: [
34
+ {
35
+ phone_number: '+919738752617',
36
+ text: 'Call us',
37
+ type: 'PHONE_NUMBER',
38
+ index: 0,
39
+ },
40
+ {
41
+ url: 'https://fast.com/',
42
+ text: 'Visit us',
43
+ type: 'STATIC_URL',
44
+ index: 1,
45
+ },
46
+ ],
47
+ category: 'ACCOUNT_UPDATE',
48
+ rejection_reason: null,
49
+ varMapped: {
34
50
  '{{1}}_1': '500',
35
51
  '{{2}}_3': 'tomorrow',
36
- }
37
- }
38
- }
39
- }
52
+ },
53
+ },
54
+ },
55
+ },
40
56
  },
41
- "isActive": true,
42
- "orgId": 50146,
43
- "createdBy": "15000449",
44
- "updatedBy": "15000449",
45
- "createdAt": "2022-02-09T05:04:06.579Z",
46
- "updatedAt": "2022-02-09T05:04:06.579Z"
57
+ isActive: true,
58
+ orgId: 50146,
59
+ createdBy: '15000449',
60
+ updatedBy: '15000449',
61
+ createdAt: '2022-02-09T05:04:06.579Z',
62
+ updatedAt: '2022-02-09T05:04:06.579Z',
47
63
  },
48
64
  },
49
65
  editData2: {
50
66
  templateDetails: {
51
- "_id": "62034b4683c75608cf2404ec",
52
- "name": "points_update",
53
- "type": "WHATSAPP",
54
- "versions": {
55
- "history": [],
56
- "base": {
57
- "content": {
58
- "whatsapp": {
59
- "status": "rejected",
60
- "templateId": "HT9bb4d61eea1699d2dbcaecd1cb558345",
61
- "accountName": "WhatsppTest",
62
- "accessToken": "4676323eb5d1f975b0987070c03a8efc",
63
- "accountId": "AC41030cebba9e2f1ce37c78235da0ee18",
64
- "mediaType": "text",
65
- "languages": [
67
+ _id: '62034b4683c75608cf2404ec',
68
+ name: 'points_update',
69
+ type: 'WHATSAPP',
70
+ versions: {
71
+ history: [],
72
+ base: {
73
+ content: {
74
+ whatsapp: {
75
+ status: 'rejected',
76
+ templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
77
+ accountName: 'WhatsppTest',
78
+ accessToken: '4676323eb5d1f975b0987070c03a8efc',
79
+ accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
80
+ mediaType: 'text',
81
+ languages: [
66
82
  {
67
- "content": "$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C\nClick {{3}} to unsubscribe'",
68
- "language": "en"
69
- }
83
+ content:
84
+ "$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C'",
85
+ language: 'en',
86
+ },
70
87
  ],
71
- "category": "ACCOUNT_UPDATE",
72
- "rejection_reason": 'INVALID_FORMAT'
73
- }
74
- }
75
- }
88
+ buttonType: 'NONE',
89
+ buttons: [],
90
+ category: 'ACCOUNT_UPDATE',
91
+ rejection_reason: 'INVALID_FORMAT',
92
+ },
93
+ },
94
+ },
76
95
  },
77
- "isActive": true,
78
- "orgId": 50146,
79
- "createdBy": "15000449",
80
- "updatedBy": "15000449",
81
- "createdAt": "2022-02-09T05:04:06.579Z",
82
- "updatedAt": "2022-02-09T05:04:06.579Z"
96
+ isActive: true,
97
+ orgId: 50146,
98
+ createdBy: '15000449',
99
+ updatedBy: '15000449',
100
+ createdAt: '2022-02-09T05:04:06.579Z',
101
+ updatedAt: '2022-02-09T05:04:06.579Z',
83
102
  },
84
103
  },
85
104
  editData3: {
86
105
  templateDetails: {
87
- "_id": "62034b4683c75608cf2404ec",
88
- "name": "points_update",
89
- "type": "WHATSAPP",
90
- "versions": {
91
- "history": [],
92
- "base": {
93
- "content": {
94
- "whatsapp": {
95
- "status": "rejected",
96
- "templateId": "HT9bb4d61eea1699d2dbcaecd1cb558345",
97
- "accountName": "WhatsppTest",
98
- "accessToken": "4676323eb5d1f975b0987070c03a8efc",
99
- "accountId": "AC41030cebba9e2f1ce37c78235da0ee18",
100
- "mediaType": "text",
101
- "languages": [
106
+ _id: '62034b4683c75608cf2404ec',
107
+ name: 'points_update',
108
+ type: 'WHATSAPP',
109
+ versions: {
110
+ history: [],
111
+ base: {
112
+ content: {
113
+ whatsapp: {
114
+ status: 'rejected',
115
+ templateId: 'HT9bb4d61eea1699d2dbcaecd1cb558345',
116
+ accountName: 'WhatsppTest',
117
+ accessToken: '4676323eb5d1f975b0987070c03a8efc',
118
+ accountId: 'AC41030cebba9e2f1ce37c78235da0ee18',
119
+ mediaType: 'text',
120
+ languages: [
102
121
  {
103
- "content": "$'Dear Customer, your{{1}} points are about to expire. Redeem before {{2}} at nearest Vishal Mega Mart and SHOP FOR FREE!\nT&C\nClick {{3}} to unsubscribe'",
104
- "language": "en"
105
- }
122
+ content: 'test',
123
+ language: 'en',
124
+ },
106
125
  ],
107
- "category": "ACCOUNT_UPDATE",
108
- "rejection_reason": 'TAG_CONTENT_MISMATCH'
109
- }
110
- }
111
- }
126
+ category: 'ACCOUNT_UPDATE',
127
+ rejection_reason: 'TAG_CONTENT_MISMATCH',
128
+ },
129
+ },
130
+ },
131
+ },
132
+ isActive: true,
133
+ orgId: 50146,
134
+ createdBy: '15000449',
135
+ updatedBy: '15000449',
136
+ createdAt: '2022-02-09T05:04:06.579Z',
137
+ updatedAt: '2022-02-09T05:04:06.579Z',
138
+ },
139
+ },
140
+ editdata4: {
141
+ _id: '62988c2f7d11ed69168252a6',
142
+ type: 'WHATSAPP',
143
+ edit: true,
144
+ name: 'test_206',
145
+ versions: {
146
+ base: {
147
+ content: {
148
+ whatsapp: {
149
+ status: 'approved',
150
+ category: 'ALERT_UPDATE',
151
+ varMapped: {
152
+ '{{1}}_1': '50',
153
+ },
154
+ mediaType: 'TEXT',
155
+ buttonType: 'CTA',
156
+ buttons: [
157
+ {
158
+ index: 0,
159
+ type: 'PHONE_NUMBER',
160
+ text: 'Call',
161
+ phone_number: '+919738752617',
162
+ },
163
+ {
164
+ index: 1,
165
+ type: 'STATIC_URL',
166
+ text: 'More info',
167
+ url: 'https://fast.com/',
168
+ },
169
+ ],
170
+ languages: [
171
+ {
172
+ language: 'en',
173
+ content:
174
+ 'You have received {{1}} points\nClick {{unsubscribe}} to unsubscribe',
175
+ },
176
+ ],
177
+ },
178
+ },
112
179
  },
113
- "isActive": true,
114
- "orgId": 50146,
115
- "createdBy": "15000449",
116
- "updatedBy": "15000449",
117
- "createdAt": "2022-02-09T05:04:06.579Z",
118
- "updatedAt": "2022-02-09T05:04:06.579Z"
119
180
  },
120
181
  },
121
182
  location: {
@@ -2,11 +2,13 @@ import {
2
2
  getWhatsappContent,
3
3
  getWhatsappStatus,
4
4
  getWhatsappCategory,
5
+ getWhatsappCta,
5
6
  } from '../utils';
6
7
  import mockdata from '../../mockdata';
7
8
 
8
9
  const {
9
10
  whatsappPreviewTemplateData,
11
+ whatsappPreviewTemplateData2,
10
12
  getWhatsappStatusOutput,
11
13
  getWhatsappCategoryOutput,
12
14
  } = mockdata;
@@ -14,6 +16,7 @@ const {
14
16
  describe('Test utils', () => {
15
17
  it('test getWhatsappContent', () => {
16
18
  expect(getWhatsappContent(whatsappPreviewTemplateData)).toMatchSnapshot();
19
+ expect(getWhatsappContent(whatsappPreviewTemplateData2)).toMatchSnapshot();
17
20
  });
18
21
 
19
22
  it('test getWhatsappContent for preview', () => {
@@ -22,6 +25,11 @@ describe('Test utils', () => {
22
25
  ).toMatchSnapshot();
23
26
  });
24
27
 
28
+ it('test getWhatsappCta', () => {
29
+ expect(getWhatsappCta(whatsappPreviewTemplateData)).toMatchSnapshot();
30
+ expect(getWhatsappCta(whatsappPreviewTemplateData2)).toMatchSnapshot();
31
+ });
32
+
25
33
  it('test getWhatsappStatus', () => {
26
34
  expect(getWhatsappStatus('approved')).toEqual(getWhatsappStatusOutput);
27
35
  });