@capillarytech/creatives-library 8.0.310 → 8.0.311
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/constants/unified.js +5 -1
- package/initialState.js +0 -2
- package/package.json +1 -1
- package/utils/common.js +5 -8
- package/utils/commonUtils.js +36 -93
- package/utils/tagValidations.js +83 -223
- package/utils/tests/commonUtil.test.js +147 -124
- package/utils/tests/tagValidations.test.js +441 -358
- package/v2Components/ErrorInfoNote/index.js +2 -5
- package/v2Components/FormBuilder/index.js +137 -203
- package/v2Components/FormBuilder/messages.js +0 -8
- package/v2Components/HtmlEditor/HTMLEditor.js +0 -5
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +0 -15
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -2
- package/v2Containers/Cap/mockData.js +0 -14
- package/v2Containers/Cap/reducer.js +3 -55
- package/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/v2Containers/CreativesContainer/SlideBoxContent.js +5 -1
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +13 -5
- package/v2Containers/CreativesContainer/constants.js +6 -0
- package/v2Containers/CreativesContainer/index.js +47 -7
- package/v2Containers/Email/index.js +1 -5
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +23 -70
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -120
- package/v2Containers/FTP/index.js +2 -51
- package/v2Containers/FTP/messages.js +0 -4
- package/v2Containers/InApp/index.js +35 -107
- package/v2Containers/InApp/tests/index.test.js +17 -6
- package/v2Containers/InappAdvance/index.js +4 -112
- package/v2Containers/InappAdvance/tests/index.test.js +2 -0
- package/v2Containers/Line/Container/Text/index.js +0 -1
- package/v2Containers/MobilePush/Create/index.js +59 -19
- package/v2Containers/MobilePush/Edit/index.js +48 -20
- package/v2Containers/MobilePushNew/index.js +12 -32
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Rcs/index.js +12 -37
- package/v2Containers/Sms/Create/index.js +39 -3
- package/v2Containers/Sms/Create/messages.js +4 -0
- package/v2Containers/Sms/Edit/index.js +35 -3
- package/v2Containers/Sms/commonMethods.js +3 -6
- package/v2Containers/Sms/tests/commonMethods.test.js +122 -0
- package/v2Containers/SmsTrai/Edit/index.js +11 -47
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -6
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TemplatesV2/index.js +28 -13
- package/v2Containers/Viber/index.js +0 -1
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -3
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/v2Containers/WebPush/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/utils/validation.js +17 -8
- package/v2Containers/WebPush/Create/utils/validation.test.js +44 -24
- package/v2Containers/Whatsapp/index.js +9 -17
- package/v2Containers/Zalo/index.js +3 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@testing-library/jest-dom';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
hasUnsubscribeTag,
|
|
4
|
+
validateTagsCore,
|
|
5
5
|
getTagMapValue,
|
|
6
6
|
getLoyaltyTagsMapValue,
|
|
7
7
|
getForwardedMapValues,
|
|
@@ -9,10 +9,160 @@ import {
|
|
|
9
9
|
validateIfTagClosed,
|
|
10
10
|
validateTags,
|
|
11
11
|
skipTags,
|
|
12
|
-
|
|
12
|
+
checkIfSupportedTag,
|
|
13
|
+
transformInjectedTags,
|
|
13
14
|
} from '../tagValidations';
|
|
14
15
|
import { containsBase64Images } from '../content';
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
describe('hasUnsubscribeTag', () => {
|
|
18
|
+
it('should return false when content is not a string', () => {
|
|
19
|
+
expect(hasUnsubscribeTag(null)).toBe(false);
|
|
20
|
+
expect(hasUnsubscribeTag(undefined)).toBe(false);
|
|
21
|
+
expect(hasUnsubscribeTag(123)).toBe(false);
|
|
22
|
+
expect(hasUnsubscribeTag({})).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should return false when content has no unsubscribe tag', () => {
|
|
26
|
+
expect(hasUnsubscribeTag('Hello world')).toBe(false);
|
|
27
|
+
expect(hasUnsubscribeTag('{{ name }}')).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should return true when content has {{ unsubscribe }}', () => {
|
|
31
|
+
expect(hasUnsubscribeTag('Click {{ unsubscribe }} here')).toBe(true);
|
|
32
|
+
expect(hasUnsubscribeTag('{{ unsubscribe }}')).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('validateTagsCore', () => {
|
|
37
|
+
it('should include isContentEmpty: false when includeIsContentEmpty is true', () => {
|
|
38
|
+
const result = validateTagsCore({
|
|
39
|
+
contentForBraceCheck: '{{a}}',
|
|
40
|
+
contentForUnsubscribeScan: '{{a}}',
|
|
41
|
+
tags: null,
|
|
42
|
+
currentModule: 'default',
|
|
43
|
+
isFullMode: true,
|
|
44
|
+
includeIsContentEmpty: true,
|
|
45
|
+
});
|
|
46
|
+
expect(result.isContentEmpty).toBe(false);
|
|
47
|
+
expect(result.valid).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should use initialMissingTags when provided', () => {
|
|
51
|
+
const result = validateTagsCore({
|
|
52
|
+
contentForBraceCheck: '{{a}}',
|
|
53
|
+
contentForUnsubscribeScan: '{{a}}',
|
|
54
|
+
tags: [{ definition: { supportedModules: [], value: 'x' } }],
|
|
55
|
+
currentModule: 'default',
|
|
56
|
+
isFullMode: false,
|
|
57
|
+
initialMissingTags: ['requiredTag'],
|
|
58
|
+
});
|
|
59
|
+
expect(result.missingTags).toEqual(['requiredTag']);
|
|
60
|
+
expect(result.valid).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should use custom skipTagsFn when provided', () => {
|
|
64
|
+
const customSkip = jest.fn(() => true);
|
|
65
|
+
const result = validateTagsCore({
|
|
66
|
+
contentForBraceCheck: '{{ unsubscribe }}',
|
|
67
|
+
contentForUnsubscribeScan: '{{ unsubscribe }}',
|
|
68
|
+
tags: [
|
|
69
|
+
{
|
|
70
|
+
definition: {
|
|
71
|
+
supportedModules: [{ context: 'DEFAULT', mandatory: true }],
|
|
72
|
+
value: 'unsubscribe',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
currentModule: 'DEFAULT',
|
|
77
|
+
isFullMode: false,
|
|
78
|
+
skipTagsFn: customSkip,
|
|
79
|
+
});
|
|
80
|
+
expect(customSkip).toHaveBeenCalled();
|
|
81
|
+
expect(result.valid).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('checkIfSupportedTag', () => {
|
|
86
|
+
it('should return false for empty or no injected tags', () => {
|
|
87
|
+
expect(checkIfSupportedTag('someTag', {})).toBe(false);
|
|
88
|
+
expect(checkIfSupportedTag('someTag', undefined)).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should return true when tag matches a top-level key', () => {
|
|
92
|
+
const injectedTags = { name: { name: 'Name' }, unsubscribe: { name: 'Unsubscribe' } };
|
|
93
|
+
expect(checkIfSupportedTag('name', injectedTags)).toBe(true);
|
|
94
|
+
expect(checkIfSupportedTag('unsubscribe', injectedTags)).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should return false when tag does not match any key', () => {
|
|
98
|
+
const injectedTags = { name: { name: 'Name' } };
|
|
99
|
+
expect(checkIfSupportedTag('other', injectedTags)).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should return true when tag matches a nested subtag', () => {
|
|
103
|
+
const injectedTags = {
|
|
104
|
+
customer: {
|
|
105
|
+
name: 'Customer',
|
|
106
|
+
subtags: {
|
|
107
|
+
first_name: { name: 'First Name' },
|
|
108
|
+
last_name: { name: 'Last Name' },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
expect(checkIfSupportedTag('first_name', injectedTags)).toBe(true);
|
|
113
|
+
expect(checkIfSupportedTag('last_name', injectedTags)).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should return false when tag is in neither top-level nor subtags', () => {
|
|
117
|
+
const injectedTags = {
|
|
118
|
+
customer: {
|
|
119
|
+
name: 'Customer',
|
|
120
|
+
subtags: { first_name: { name: 'First Name' } },
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
expect(checkIfSupportedTag('unknown', injectedTags)).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('transformInjectedTags', () => {
|
|
128
|
+
it('should add tag-header and normalize subtags when key contains "subtags"', () => {
|
|
129
|
+
const tags = [
|
|
130
|
+
{
|
|
131
|
+
name: 'Customer',
|
|
132
|
+
subtags: {
|
|
133
|
+
first_name: { name: 'First Name' },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
const result = transformInjectedTags(tags);
|
|
138
|
+
expect(result).toBe(tags);
|
|
139
|
+
expect(tags[0]['tag-header']).toBe(true);
|
|
140
|
+
expect(tags[0].subtags).toEqual({ first_name: { name: 'First Name' } });
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should recursively transform nested subtags', () => {
|
|
144
|
+
const tags = [
|
|
145
|
+
{
|
|
146
|
+
name: 'Parent',
|
|
147
|
+
subtags: {
|
|
148
|
+
child: {
|
|
149
|
+
name: 'Child',
|
|
150
|
+
subtags: { grandchild: { name: 'Grandchild' } },
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
transformInjectedTags(tags);
|
|
156
|
+
expect(tags[0].subtags.child.subtags).toEqual({ grandchild: { name: 'Grandchild' } });
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should return tags unchanged when no subtag keys exist', () => {
|
|
160
|
+
const tags = [{ name: 'Simple', desc: 'No subtags' }];
|
|
161
|
+
const result = transformInjectedTags(tags);
|
|
162
|
+
expect(result).toBe(tags);
|
|
163
|
+
expect(tags[0]).toEqual({ name: 'Simple', desc: 'No subtags' });
|
|
164
|
+
});
|
|
165
|
+
});
|
|
16
166
|
|
|
17
167
|
describe("check if curly brackets are balanced", () => {
|
|
18
168
|
it("test for balanced curly brackets", () => {
|
|
@@ -22,6 +172,9 @@ describe("check if curly brackets are balanced", () => {
|
|
|
22
172
|
value += "}}"
|
|
23
173
|
let result = validateIfTagClosed(value);
|
|
24
174
|
expect(result).toEqual(true);
|
|
175
|
+
// no braces or empty string: match returns null, l1/l2/l3 undefined -> true
|
|
176
|
+
expect(validateIfTagClosed("")).toEqual(true);
|
|
177
|
+
expect(validateIfTagClosed("plain text no braces")).toEqual(true);
|
|
25
178
|
//valid cases
|
|
26
179
|
expect(validateIfTagClosed("{{{Hello}}}")).toEqual(true);
|
|
27
180
|
expect(validateIfTagClosed("{{{Hello}}")).toEqual(true);
|
|
@@ -64,53 +217,41 @@ describe("validateTags", () => {
|
|
|
64
217
|
it("should return valid response when all tags are present", () => {
|
|
65
218
|
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{entryTrigger.lifetimePurchases}}";
|
|
66
219
|
|
|
67
|
-
const injectedTagsParams = [];
|
|
68
220
|
const location = { query: { module: "DEFAULT" } };
|
|
69
221
|
const tagModule = null;
|
|
70
222
|
|
|
71
223
|
const result = validateTags({
|
|
72
224
|
content,
|
|
73
225
|
tagsParam,
|
|
74
|
-
injectedTagsParams,
|
|
75
226
|
location,
|
|
76
227
|
tagModule,
|
|
77
|
-
eventContextTags,
|
|
78
228
|
});
|
|
79
229
|
|
|
80
230
|
expect(result.valid).toEqual(true);
|
|
81
231
|
expect(result.missingTags).toEqual([]);
|
|
82
|
-
expect(result.unsupportedTags).toEqual([]);
|
|
83
232
|
expect(result.isBraceError).toEqual(false);
|
|
84
233
|
});
|
|
85
234
|
|
|
86
|
-
it("should return
|
|
235
|
+
it("should return valid response when content has balanced braces and all tags present", () => {
|
|
87
236
|
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}}";
|
|
88
|
-
const updatedTagsParam = [...tagsParam, {
|
|
89
|
-
definition: {
|
|
90
|
-
supportedModules: [{ context: "DEFAULT", mandatory: true }],
|
|
91
|
-
value: "tag4",
|
|
92
|
-
},
|
|
93
|
-
},];
|
|
94
|
-
const injectedTagsParams = [];
|
|
95
237
|
const location = { query: { module: "DEFAULT" } };
|
|
96
238
|
const tagModule = null;
|
|
97
239
|
|
|
98
240
|
const result = validateTags({
|
|
99
241
|
content,
|
|
100
|
-
|
|
101
|
-
injectedTagsParams,
|
|
242
|
+
tagsParam,
|
|
102
243
|
location,
|
|
103
244
|
tagModule,
|
|
104
245
|
});
|
|
105
246
|
|
|
106
247
|
expect(result.valid).toEqual(true);
|
|
107
|
-
expect(result.
|
|
248
|
+
expect(result.missingTags).toEqual([]);
|
|
108
249
|
expect(result.isBraceError).toEqual(false);
|
|
109
250
|
});
|
|
110
251
|
|
|
111
|
-
it("should return
|
|
252
|
+
it("should return valid response when content has balanced braces with missingEventContextTags and partial tagsParam", () => {
|
|
112
253
|
const content = "Hello {{tag1}}, {{tag2}}, {{tag3}} {{missingEventContextTags}}";
|
|
113
|
-
const
|
|
254
|
+
const tagsParamLocal = [
|
|
114
255
|
{
|
|
115
256
|
definition: {
|
|
116
257
|
supportedModules: [{ context: "DEFAULT", mandatory: true }],
|
|
@@ -124,27 +265,24 @@ describe("validateTags", () => {
|
|
|
124
265
|
},
|
|
125
266
|
},
|
|
126
267
|
];
|
|
127
|
-
const injectedTagsParams = [];
|
|
128
268
|
const location = { query: { module: "DEFAULT" } };
|
|
129
269
|
const tagModule = null;
|
|
130
270
|
|
|
131
271
|
const result = validateTags({
|
|
132
272
|
content,
|
|
133
|
-
tagsParam,
|
|
134
|
-
injectedTagsParams,
|
|
273
|
+
tagsParam: tagsParamLocal,
|
|
135
274
|
location,
|
|
136
275
|
tagModule,
|
|
137
276
|
});
|
|
138
277
|
|
|
139
278
|
expect(result.valid).toEqual(true);
|
|
140
279
|
expect(result.missingTags).toEqual([]);
|
|
141
|
-
expect(result.unsupportedTags).toEqual(["tag3", "missingEventContextTags"]);
|
|
142
280
|
expect(result.isBraceError).toEqual(false);
|
|
143
281
|
});
|
|
144
282
|
|
|
145
283
|
it("should return invalid response when there is an unbalanced bracket error", () => {
|
|
146
284
|
const content = "Hello {{tag1}, {{tag2}}, {{tag3}}";
|
|
147
|
-
const
|
|
285
|
+
const tagsParamLocal = [
|
|
148
286
|
{
|
|
149
287
|
definition: {
|
|
150
288
|
supportedModules: [{ context: "DEFAULT", mandatory: true }],
|
|
@@ -164,26 +302,23 @@ describe("validateTags", () => {
|
|
|
164
302
|
},
|
|
165
303
|
},
|
|
166
304
|
];
|
|
167
|
-
const injectedTagsParams = [];
|
|
168
305
|
const location = { query: { module: "DEFAULT" } };
|
|
169
306
|
const tagModule = null;
|
|
170
307
|
|
|
171
308
|
const result = validateTags({
|
|
172
309
|
content,
|
|
173
|
-
tagsParam,
|
|
174
|
-
injectedTagsParams,
|
|
310
|
+
tagsParam: tagsParamLocal,
|
|
175
311
|
location,
|
|
176
312
|
tagModule,
|
|
177
313
|
});
|
|
178
314
|
|
|
179
315
|
expect(result.valid).toEqual(false);
|
|
180
|
-
expect(result.missingTags).toEqual([
|
|
181
|
-
expect(result.unsupportedTags).toEqual([]);
|
|
316
|
+
expect(result.missingTags).toEqual([]);
|
|
182
317
|
expect(result.isBraceError).toEqual(true);
|
|
183
318
|
});
|
|
184
319
|
|
|
185
|
-
it("should
|
|
186
|
-
const
|
|
320
|
+
it("should require unsubscribe when mandatory and missing, and accept skipped unsubscribe variant", () => {
|
|
321
|
+
const tagsParamUnsubscribe = [
|
|
187
322
|
{
|
|
188
323
|
definition: {
|
|
189
324
|
supportedModules: [{ context: "DEFAULT", mandatory: true }],
|
|
@@ -191,288 +326,310 @@ describe("validateTags", () => {
|
|
|
191
326
|
},
|
|
192
327
|
},
|
|
193
328
|
];
|
|
194
|
-
// Content does not include {{unsubscribe}}, so it would be missing
|
|
195
|
-
const contentMissing = "Hello {{tag1}}";
|
|
196
|
-
const injectedTagsParams = [];
|
|
197
329
|
const location = { query: { module: "DEFAULT" } };
|
|
198
330
|
const tagModule = null;
|
|
199
331
|
|
|
200
|
-
|
|
332
|
+
const contentMissing = "Hello world";
|
|
201
333
|
const resultMissing = validateTags({
|
|
202
334
|
content: contentMissing,
|
|
203
|
-
tagsParam,
|
|
204
|
-
injectedTagsParams,
|
|
335
|
+
tagsParam: tagsParamUnsubscribe,
|
|
205
336
|
location,
|
|
206
337
|
tagModule,
|
|
207
338
|
});
|
|
208
339
|
expect(resultMissing.missingTags).toContain("unsubscribe");
|
|
340
|
+
expect(resultMissing.valid).toBe(false);
|
|
209
341
|
|
|
210
|
-
// Now, content includes a tag that triggers skipTags logic for unsubscribe
|
|
211
|
-
// e.g., {{unsubscribe(#123456)}} matches the skipTags regex
|
|
212
342
|
const contentWithSkippedUnsubscribe = "Hello {{unsubscribe(#123456)}}";
|
|
213
343
|
const resultSkipped = validateTags({
|
|
214
344
|
content: contentWithSkippedUnsubscribe,
|
|
215
|
-
tagsParam,
|
|
216
|
-
injectedTagsParams,
|
|
345
|
+
tagsParam: tagsParamUnsubscribe,
|
|
217
346
|
location,
|
|
218
347
|
tagModule,
|
|
219
348
|
});
|
|
220
349
|
expect(resultSkipped.missingTags).not.toContain("unsubscribe");
|
|
221
350
|
expect(resultSkipped.valid).toBe(true);
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
351
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
352
|
+
const contentWithWhitespaceUnsubscribe = "Hello {{ unsubscribe }}";
|
|
353
|
+
const resultWhitespace = validateTags({
|
|
354
|
+
content: contentWithWhitespaceUnsubscribe,
|
|
355
|
+
tagsParam: tagsParamUnsubscribe,
|
|
356
|
+
location,
|
|
357
|
+
tagModule,
|
|
358
|
+
});
|
|
359
|
+
expect(resultWhitespace.missingTags).not.toContain("unsubscribe");
|
|
360
|
+
expect(resultWhitespace.valid).toBe(true);
|
|
361
|
+
expect(resultWhitespace.unsupportedTags ?? []).toEqual([]);
|
|
230
362
|
});
|
|
363
|
+
});
|
|
231
364
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
name: "Node 1.1",
|
|
239
|
-
children: [],
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: "Node 1.2",
|
|
243
|
-
children: [],
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "Node 2",
|
|
249
|
-
children: [
|
|
250
|
-
{
|
|
251
|
-
name: "Node 2.1",
|
|
252
|
-
children: [],
|
|
253
|
-
},
|
|
254
|
-
],
|
|
365
|
+
describe('validateTags wrapper (v2 consumers)', () => {
|
|
366
|
+
const tagsWithUnsubscribe = [
|
|
367
|
+
{
|
|
368
|
+
definition: {
|
|
369
|
+
supportedModules: [{ context: 'DEFAULT', mandatory: true }],
|
|
370
|
+
value: 'unsubscribe',
|
|
255
371
|
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
"Node 2.1",
|
|
264
|
-
]);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it("should ignore nodes without names", () => {
|
|
268
|
-
const data = [
|
|
269
|
-
{
|
|
270
|
-
name: "Node 1",
|
|
271
|
-
children: [
|
|
272
|
-
{
|
|
273
|
-
name: "Node 1.1",
|
|
274
|
-
children: [],
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
children: [],
|
|
278
|
-
},
|
|
279
|
-
],
|
|
372
|
+
},
|
|
373
|
+
];
|
|
374
|
+
const tagsOutboundUnsubscribe = [
|
|
375
|
+
{
|
|
376
|
+
definition: {
|
|
377
|
+
supportedModules: [{ context: 'outbound', mandatory: true }],
|
|
378
|
+
value: 'unsubscribe',
|
|
280
379
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
{
|
|
289
|
-
name: "Node 2.2",
|
|
290
|
-
},
|
|
291
|
-
],
|
|
380
|
+
},
|
|
381
|
+
];
|
|
382
|
+
const tagsDefaultLowercase = [
|
|
383
|
+
{
|
|
384
|
+
definition: {
|
|
385
|
+
supportedModules: [{ context: 'default', mandatory: true }],
|
|
386
|
+
value: 'unsubscribe',
|
|
292
387
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
expect(result).toEqual([
|
|
296
|
-
"Node 1",
|
|
297
|
-
"Node 1.1",
|
|
298
|
-
"Node 2",
|
|
299
|
-
"Node 2.1",
|
|
300
|
-
"Node 2.2",
|
|
301
|
-
]);
|
|
302
|
-
});
|
|
303
|
-
});
|
|
388
|
+
},
|
|
389
|
+
];
|
|
304
390
|
|
|
391
|
+
describe('module selection (location.query.module vs tagModule vs DEFAULT)', () => {
|
|
392
|
+
it('uses location.query.module when set and tagModule not provided', () => {
|
|
393
|
+
const content = 'Hello world';
|
|
394
|
+
const result = validateTags({
|
|
395
|
+
content,
|
|
396
|
+
tagsParam: tagsWithUnsubscribe,
|
|
397
|
+
location: { query: { module: 'DEFAULT' } },
|
|
398
|
+
tagModule: null,
|
|
399
|
+
});
|
|
400
|
+
expect(result.missingTags).toContain('unsubscribe');
|
|
401
|
+
expect(result.valid).toBe(false);
|
|
402
|
+
});
|
|
305
403
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
404
|
+
it('uses tagModule override when provided (overrides location.query.module)', () => {
|
|
405
|
+
const content = 'Hello world';
|
|
406
|
+
const resultWithOutbound = validateTags({
|
|
407
|
+
content,
|
|
408
|
+
tagsParam: tagsOutboundUnsubscribe,
|
|
409
|
+
location: { query: { module: 'DEFAULT' } },
|
|
410
|
+
tagModule: 'outbound',
|
|
411
|
+
});
|
|
412
|
+
expect(resultWithOutbound.missingTags).toContain('unsubscribe');
|
|
413
|
+
expect(resultWithOutbound.valid).toBe(false);
|
|
414
|
+
|
|
415
|
+
const resultWithDefault = validateTags({
|
|
416
|
+
content,
|
|
417
|
+
tagsParam: tagsWithUnsubscribe,
|
|
418
|
+
location: { query: { module: 'outbound' } },
|
|
419
|
+
tagModule: 'DEFAULT',
|
|
420
|
+
});
|
|
421
|
+
expect(resultWithDefault.missingTags).toContain('unsubscribe');
|
|
422
|
+
expect(resultWithDefault.valid).toBe(false);
|
|
423
|
+
});
|
|
317
424
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
425
|
+
it('uses DEFAULT (lowercase) when location is undefined', () => {
|
|
426
|
+
const content = 'Hello world';
|
|
427
|
+
const result = validateTags({
|
|
428
|
+
content,
|
|
429
|
+
tagsParam: tagsDefaultLowercase,
|
|
430
|
+
location: undefined,
|
|
431
|
+
tagModule: null,
|
|
432
|
+
});
|
|
433
|
+
expect(result.missingTags).toContain('unsubscribe');
|
|
434
|
+
expect(result.valid).toBe(false);
|
|
435
|
+
});
|
|
326
436
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
437
|
+
it('uses DEFAULT when location.query is undefined', () => {
|
|
438
|
+
const content = 'Hello world';
|
|
439
|
+
const result = validateTags({
|
|
440
|
+
content,
|
|
441
|
+
tagsParam: tagsDefaultLowercase,
|
|
442
|
+
location: {},
|
|
443
|
+
tagModule: null,
|
|
444
|
+
});
|
|
445
|
+
expect(result.missingTags).toContain('unsubscribe');
|
|
446
|
+
expect(result.valid).toBe(false);
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it('uses DEFAULT when location.query.module is falsy', () => {
|
|
450
|
+
const content = 'Hello world';
|
|
451
|
+
const result = validateTags({
|
|
452
|
+
content,
|
|
453
|
+
tagsParam: tagsDefaultLowercase,
|
|
454
|
+
location: { query: { module: '' } },
|
|
455
|
+
tagModule: null,
|
|
456
|
+
});
|
|
457
|
+
expect(result.missingTags).toContain('unsubscribe');
|
|
458
|
+
expect(result.valid).toBe(false);
|
|
459
|
+
});
|
|
334
460
|
});
|
|
335
461
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
462
|
+
describe('content passed to contentForBraceCheck and contentForUnsubscribeScan', () => {
|
|
463
|
+
it('uses same content for brace check (isBraceError when unbalanced)', () => {
|
|
464
|
+
const content = 'Hello {{tag1}, {{tag2}}';
|
|
465
|
+
const result = validateTags({
|
|
466
|
+
content,
|
|
467
|
+
tagsParam: [],
|
|
468
|
+
location: { query: { module: 'DEFAULT' } },
|
|
469
|
+
});
|
|
470
|
+
expect(result.isBraceError).toBe(true);
|
|
471
|
+
expect(result.valid).toBe(false);
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it('uses same content for unsubscribe scan (missing unsubscribe when required)', () => {
|
|
475
|
+
const content = 'Hello {{other}}';
|
|
476
|
+
const result = validateTags({
|
|
477
|
+
content,
|
|
478
|
+
tagsParam: tagsWithUnsubscribe,
|
|
479
|
+
location: { query: { module: 'DEFAULT' } },
|
|
480
|
+
});
|
|
481
|
+
expect(result.missingTags).toContain('unsubscribe');
|
|
482
|
+
expect(result.valid).toBe(false);
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it('content with {{ unsubscribe }} satisfies unsubscribe requirement', () => {
|
|
486
|
+
const content = 'Hello {{ unsubscribe }}';
|
|
487
|
+
const result = validateTags({
|
|
488
|
+
content,
|
|
489
|
+
tagsParam: tagsWithUnsubscribe,
|
|
490
|
+
location: { query: { module: 'DEFAULT' } },
|
|
491
|
+
});
|
|
492
|
+
expect(result.missingTags).not.toContain('unsubscribe');
|
|
493
|
+
expect(result.valid).toBe(true);
|
|
494
|
+
});
|
|
347
495
|
});
|
|
348
496
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
|
|
497
|
+
describe('isFullMode', () => {
|
|
498
|
+
it('when true skips unsubscribe check (no missingTags for mandatory unsubscribe)', () => {
|
|
499
|
+
const content = 'Hello world';
|
|
500
|
+
const result = validateTags({
|
|
501
|
+
content,
|
|
502
|
+
tagsParam: tagsWithUnsubscribe,
|
|
503
|
+
location: { query: { module: 'DEFAULT' } },
|
|
504
|
+
isFullMode: true,
|
|
505
|
+
});
|
|
506
|
+
expect(result.missingTags).toEqual([]);
|
|
507
|
+
expect(result.valid).toBe(true);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it('when true still runs brace check', () => {
|
|
511
|
+
const content = 'Hello {{tag1}';
|
|
512
|
+
const result = validateTags({
|
|
513
|
+
content,
|
|
514
|
+
tagsParam: tagsWithUnsubscribe,
|
|
515
|
+
location: { query: { module: 'DEFAULT' } },
|
|
516
|
+
isFullMode: true,
|
|
517
|
+
});
|
|
518
|
+
expect(result.isBraceError).toBe(true);
|
|
519
|
+
expect(result.valid).toBe(false);
|
|
520
|
+
});
|
|
363
521
|
});
|
|
364
522
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
523
|
+
describe('tagsParam null or empty', () => {
|
|
524
|
+
it('when null: only brace check runs, no missing-tag logic', () => {
|
|
525
|
+
const content = 'Hello {{a}}';
|
|
526
|
+
const result = validateTags({
|
|
527
|
+
content,
|
|
528
|
+
tagsParam: null,
|
|
529
|
+
location: { query: { module: 'DEFAULT' } },
|
|
530
|
+
});
|
|
531
|
+
expect(result.missingTags).toEqual([]);
|
|
532
|
+
expect(result.isBraceError).toBe(false);
|
|
533
|
+
expect(result.valid).toBe(true);
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it('when empty array: only brace check runs', () => {
|
|
537
|
+
const content = 'Hello {{a}}';
|
|
538
|
+
const result = validateTags({
|
|
539
|
+
content,
|
|
540
|
+
tagsParam: [],
|
|
541
|
+
location: { query: { module: 'DEFAULT' } },
|
|
542
|
+
});
|
|
543
|
+
expect(result.missingTags).toEqual([]);
|
|
544
|
+
expect(result.valid).toBe(true);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it('when null with unbalanced braces: returns isBraceError', () => {
|
|
548
|
+
const content = 'Hello {{a}';
|
|
549
|
+
const result = validateTags({
|
|
550
|
+
content,
|
|
551
|
+
tagsParam: null,
|
|
552
|
+
location: { query: { module: 'DEFAULT' } },
|
|
553
|
+
});
|
|
554
|
+
expect(result.isBraceError).toBe(true);
|
|
555
|
+
expect(result.valid).toBe(false);
|
|
556
|
+
expect(result.missingTags).toEqual([]);
|
|
557
|
+
});
|
|
376
558
|
});
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
{
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
const tagObject = {};
|
|
452
|
-
const eventContextTags = [{ tagName: "leaderboard", subTags: ["userId"]}];
|
|
453
|
-
const isLiquidFlow = false;
|
|
454
|
-
const result = checkSupport(response, tagObject, eventContextTags, isLiquidFlow);
|
|
455
|
-
expect(result).toEqual( [ 'leaderboard' ]);
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
it("test for checking loyalty tags in that are coming in forwardedTags", () => {
|
|
459
|
-
const response = { data: [{ name: "leaderboard", children: [{name: "person.userId"}]}]};
|
|
460
|
-
const tagObject = {};
|
|
461
|
-
const isLiquidFlow = true;
|
|
462
|
-
// forwardedTags contains tag hierarchy with parent tags and their subtags
|
|
463
|
-
// needed for loyalty email liquid tag resolution
|
|
464
|
-
const forwardedTags = {
|
|
465
|
-
leaderboard: {
|
|
466
|
-
name: "Leaderboard",
|
|
467
|
-
subtags: {
|
|
468
|
-
"person.userId": {
|
|
469
|
-
name: "User ID",
|
|
470
|
-
},
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
};
|
|
474
|
-
const result = checkSupport(response, tagObject, [], isLiquidFlow, forwardedTags);
|
|
475
|
-
expect(result).toEqual( [ 'leaderboard', 'person.userId' ]);
|
|
559
|
+
|
|
560
|
+
describe('v2 consumer call patterns', () => {
|
|
561
|
+
it('Whatsapp-style: content, tagsParam, location, tagModule (getDefaultTags), isFullMode', () => {
|
|
562
|
+
const content = 'Hello {{ unsubscribe }}';
|
|
563
|
+
const result = validateTags({
|
|
564
|
+
content: content,
|
|
565
|
+
tagsParam: tagsWithUnsubscribe,
|
|
566
|
+
location: { query: { module: 'DEFAULT' } },
|
|
567
|
+
tagModule: 'DEFAULT',
|
|
568
|
+
isFullMode: false,
|
|
569
|
+
});
|
|
570
|
+
expect(result.valid).toBe(true);
|
|
571
|
+
expect(result.isBraceError).toBe(false);
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
it('Zalo / Rcs / MobilePushNew / EmailWrapper: same pattern as Whatsapp', () => {
|
|
575
|
+
const result = validateTags({
|
|
576
|
+
content: 'Hi {{ unsubscribe }}',
|
|
577
|
+
tagsParam: tagsWithUnsubscribe,
|
|
578
|
+
location: { query: { module: 'DEFAULT' } },
|
|
579
|
+
tagModule: 'DEFAULT',
|
|
580
|
+
isFullMode: false,
|
|
581
|
+
});
|
|
582
|
+
expect(result.valid).toBe(true);
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
it('Line / Viber: tagModule "outbound"', () => {
|
|
586
|
+
const contentMissing = 'Hello';
|
|
587
|
+
const resultMissing = validateTags({
|
|
588
|
+
content: contentMissing,
|
|
589
|
+
tagsParam: tagsOutboundUnsubscribe,
|
|
590
|
+
location: { query: { module: 'inbound' } },
|
|
591
|
+
tagModule: 'outbound',
|
|
592
|
+
isFullMode: false,
|
|
593
|
+
});
|
|
594
|
+
expect(resultMissing.missingTags).toContain('unsubscribe');
|
|
595
|
+
expect(resultMissing.valid).toBe(false);
|
|
596
|
+
|
|
597
|
+
const resultOk = validateTags({
|
|
598
|
+
content: 'Hello {{ unsubscribe }}',
|
|
599
|
+
tagsParam: tagsOutboundUnsubscribe,
|
|
600
|
+
location: {},
|
|
601
|
+
tagModule: 'outbound',
|
|
602
|
+
isFullMode: false,
|
|
603
|
+
});
|
|
604
|
+
expect(resultOk.valid).toBe(true);
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
it('WebPush: validationConfig spread (content + tagsParam, location, tagModule, isFullMode)', () => {
|
|
608
|
+
const validationConfig = {
|
|
609
|
+
tagsParam: tagsWithUnsubscribe,
|
|
610
|
+
location: { query: { module: 'DEFAULT' } },
|
|
611
|
+
tagModule: 'DEFAULT',
|
|
612
|
+
};
|
|
613
|
+
const result = validateTags({
|
|
614
|
+
content: 'Hello {{ unsubscribe }}',
|
|
615
|
+
...validationConfig,
|
|
616
|
+
isFullMode: false,
|
|
617
|
+
});
|
|
618
|
+
expect(result.valid).toBe(true);
|
|
619
|
+
expect(result.isBraceError).toBe(false);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
it('WebPush with isFullMode: only brace check', () => {
|
|
623
|
+
const result = validateTags({
|
|
624
|
+
content: 'Hello world',
|
|
625
|
+
tagsParam: tagsWithUnsubscribe,
|
|
626
|
+
location: { query: { module: 'DEFAULT' } },
|
|
627
|
+
tagModule: 'DEFAULT',
|
|
628
|
+
isFullMode: true,
|
|
629
|
+
});
|
|
630
|
+
expect(result.valid).toBe(true);
|
|
631
|
+
expect(result.missingTags).toEqual([]);
|
|
632
|
+
});
|
|
476
633
|
});
|
|
477
634
|
});
|
|
478
635
|
|
|
@@ -1048,6 +1205,10 @@ describe('getForwardedMapValues', () => {
|
|
|
1048
1205
|
expect(getForwardedMapValues(input)).toEqual(expected);
|
|
1049
1206
|
});
|
|
1050
1207
|
|
|
1208
|
+
test('should return empty object when called with no argument (default param)', () => {
|
|
1209
|
+
expect(getForwardedMapValues()).toEqual({});
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1051
1212
|
test('should correctly process objects with subtags', () => {
|
|
1052
1213
|
const input = {
|
|
1053
1214
|
customer: {
|
|
@@ -1309,84 +1470,6 @@ describe('getForwardedMapValues', () => {
|
|
|
1309
1470
|
});
|
|
1310
1471
|
});
|
|
1311
1472
|
|
|
1312
|
-
describe('isInsideLiquidBlock', () => {
|
|
1313
|
-
it('returns true for index inside a single block', () => {
|
|
1314
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1315
|
-
// Index of 'a' in 'assign' inside the block
|
|
1316
|
-
const tagIndex = content.indexOf('assign');
|
|
1317
|
-
expect(isInsideLiquidBlock(content, tagIndex)).toBe(true);
|
|
1318
|
-
});
|
|
1319
|
-
|
|
1320
|
-
it('returns false for index outside any block', () => {
|
|
1321
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1322
|
-
// Index of 'H' in 'Hello'
|
|
1323
|
-
expect(isInsideLiquidBlock(content, 0)).toBe(false);
|
|
1324
|
-
// Index of 'W' in 'World'
|
|
1325
|
-
expect(isInsideLiquidBlock(content, content.indexOf('World'))).toBe(false);
|
|
1326
|
-
});
|
|
1327
|
-
|
|
1328
|
-
it('returns true for index at the start of a block', () => {
|
|
1329
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1330
|
-
// Index of '{' in '{%'
|
|
1331
|
-
const tagIndex = content.indexOf('{%');
|
|
1332
|
-
expect(isInsideLiquidBlock(content, tagIndex)).toBe(true);
|
|
1333
|
-
});
|
|
1334
|
-
|
|
1335
|
-
it('returns false for index at the end of a block (exclusive)', () => {
|
|
1336
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1337
|
-
// Index just after the closing '%}'
|
|
1338
|
-
const blockEnd = content.indexOf('%}') + 2;
|
|
1339
|
-
expect(isInsideLiquidBlock(content, blockEnd)).toBe(false);
|
|
1340
|
-
});
|
|
1341
|
-
|
|
1342
|
-
it('returns true for index inside the second of multiple blocks', () => {
|
|
1343
|
-
const content = 'A {% first %} B {% second %} C';
|
|
1344
|
-
const tagIndex = content.indexOf('second');
|
|
1345
|
-
expect(isInsideLiquidBlock(content, tagIndex)).toBe(true);
|
|
1346
|
-
});
|
|
1347
|
-
|
|
1348
|
-
it('returns false for index between blocks', () => {
|
|
1349
|
-
const content = 'A {% first %} B {% second %} C';
|
|
1350
|
-
// Index of 'B' (between blocks)
|
|
1351
|
-
const tagIndex = content.indexOf('B');
|
|
1352
|
-
expect(isInsideLiquidBlock(content, tagIndex)).toBe(false);
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
it('returns false for empty string', () => {
|
|
1356
|
-
expect(isInsideLiquidBlock('', 0)).toBe(false);
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1359
|
-
it('returns false if there are no blocks', () => {
|
|
1360
|
-
const content = 'Just some text with no blocks';
|
|
1361
|
-
expect(isInsideLiquidBlock(content, 5)).toBe(false);
|
|
1362
|
-
});
|
|
1363
|
-
|
|
1364
|
-
it('returns false for negative index', () => {
|
|
1365
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1366
|
-
expect(isInsideLiquidBlock(content, -1)).toBe(false);
|
|
1367
|
-
});
|
|
1368
|
-
|
|
1369
|
-
it('returns false for index beyond string length', () => {
|
|
1370
|
-
const content = 'Hello {% assign foo = 1 %} World';
|
|
1371
|
-
expect(isInsideLiquidBlock(content, 100)).toBe(false);
|
|
1372
|
-
});
|
|
1373
|
-
|
|
1374
|
-
it('works for nested-like blocks (not truly nested)', () => {
|
|
1375
|
-
const content = 'A {% outer {% inner %} outer %} B';
|
|
1376
|
-
// Index of 'inner' (should be inside the first block)
|
|
1377
|
-
const tagIndex = content.indexOf('inner');
|
|
1378
|
-
expect(isInsideLiquidBlock(content, tagIndex)).toBe(true);
|
|
1379
|
-
});
|
|
1380
|
-
|
|
1381
|
-
it('returns true for index at last char inside block', () => {
|
|
1382
|
-
const content = 'A {% foo %} B';
|
|
1383
|
-
// Index of last char inside block (just before %})
|
|
1384
|
-
const blockStart = content.indexOf('{%');
|
|
1385
|
-
const blockEnd = content.indexOf('%}');
|
|
1386
|
-
expect(isInsideLiquidBlock(content, blockEnd - 1)).toBe(true);
|
|
1387
|
-
});
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
1473
|
describe('containsBase64Images', () => {
|
|
1391
1474
|
let mockCapNotification;
|
|
1392
1475
|
let mockCallback;
|