@capillarytech/creatives-library 7.12.120 → 7.13.5
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 -2
- package/routes.js +0 -1
- package/services/api.js +1 -6
- package/v2Components/FormBuilder/index.js +13 -18
- package/v2Components/NewCallTask/index.js +1 -3
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Containers/CallTask/index.js +2 -4
- package/v2Containers/Cap/actions.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -0
- package/v2Containers/CreativesContainer/actions.js +1 -1
- package/v2Containers/CreativesContainer/index.js +2 -6
- package/v2Containers/CreativesContainer/tests/index.test.js +0 -4
- package/v2Containers/Email/index.js +1 -4
- package/v2Containers/Facebook/Advertisement/index.js +4 -4
- package/v2Containers/Line/Container/Image/index.js +4 -5
- package/v2Containers/Line/Container/ImageCarousel/index.js +5 -6
- package/v2Containers/Line/Container/ImageMap/index.js +1 -2
- package/v2Containers/MobilePush/Create/index.js +8 -5
- package/v2Containers/MobilePush/Edit/index.js +4 -4
- package/v2Containers/MobilePush/initialSchema.js +0 -4
- package/v2Containers/MobilepushWrapper/index.js +1 -0
- package/v2Containers/Rcs/index.js +1 -2
- package/v2Containers/Templates/actions.js +0 -6
- package/v2Containers/Templates/constants.js +0 -4
- package/v2Containers/Templates/sagas.js +0 -25
- package/v2Containers/TemplatesV2/index.js +1 -5
- package/v2Containers/Viber/index.js +2 -11
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1 -3
- package/v2Containers/Whatsapp/index.js +2 -4
- package/utils/cdnTransformation.js +0 -419
- package/utils/tests/__snapshots__/cdnTransformation.test.js.snap +0 -298
- package/utils/tests/cdnTransformation.mockdata.js +0 -301
- package/utils/tests/cdnTransformation.test.js +0 -305
- package/v2Components/FormBuilder/tests/index.test.js +0 -41
- package/v2Components/FormBuilder/tests/mockData.js +0 -120
- package/v2Components/NewCallTask/tests/index.test.js +0 -36
- package/v2Components/NewCallTask/tests/mockData.js +0 -20
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
import * as cdnUtils from "../cdnTransformation";
|
|
2
|
-
import * as mockdata from "./cdnTransformation.mockdata";
|
|
3
|
-
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
var localStorageMock = (function () {
|
|
6
|
-
var store = {
|
|
7
|
-
CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX: "cdn-cgi/image",
|
|
8
|
-
CREATIVES_S3_BUCKET_PATH: "intouch_creative_assets",
|
|
9
|
-
CREATIVES_CDN_BASE_URL: "https://storage.crm.n.content-cdn.io",
|
|
10
|
-
CREATIVES_CDN_QUALITY_CONFIG:
|
|
11
|
-
'{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}',
|
|
12
|
-
};
|
|
13
|
-
return {
|
|
14
|
-
getItem: function (key) {
|
|
15
|
-
return store[key];
|
|
16
|
-
},
|
|
17
|
-
setItem: function (key, value) {
|
|
18
|
-
store[key] = value.toString();
|
|
19
|
-
},
|
|
20
|
-
clear: function () {
|
|
21
|
-
store = {};
|
|
22
|
-
},
|
|
23
|
-
removeItem: function (key) {
|
|
24
|
-
delete store[key];
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
Object.defineProperty(window, "localStorage", { value: localStorageMock });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
afterEach(() => {
|
|
32
|
-
localStorage.setItem(
|
|
33
|
-
"CREATIVES_CDN_QUALITY_CONFIG",
|
|
34
|
-
'{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}'
|
|
35
|
-
);
|
|
36
|
-
localStorage.setItem(
|
|
37
|
-
"CREATIVES_S3_BUCKET_PATH", "intouch_creative_assets"
|
|
38
|
-
);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe("cdnTransformationTests", () => {
|
|
42
|
-
describe("getCdnUrl()", () => {
|
|
43
|
-
it("should return s3 url if bucket subfolder doesn't contain intouch_creative_assets", () => {
|
|
44
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/test/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
45
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
46
|
-
url: TEST_S3_URL,
|
|
47
|
-
channelName: "EMAIL",
|
|
48
|
-
});
|
|
49
|
-
expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should return s3 if channelName is not defined", () => {
|
|
53
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
54
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({ url: TEST_S3_URL });
|
|
55
|
-
expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("should return s3 if specified channelSubType doesn't exist", () => {
|
|
59
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
60
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
61
|
-
url: TEST_S3_URL,
|
|
62
|
-
channelName: "LINE",
|
|
63
|
-
channelSubType: "ABC",
|
|
64
|
-
});
|
|
65
|
-
expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("Should replace s3 url with cdn url for email when h/w are not provided", () => {
|
|
69
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
70
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
71
|
-
url: TEST_S3_URL,
|
|
72
|
-
channelName: "EMAIL",
|
|
73
|
-
});
|
|
74
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
75
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("Should replace s3 url with cdn url for email when h/w are provided", () => {
|
|
79
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
80
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
81
|
-
url: TEST_S3_URL,
|
|
82
|
-
channelName: "EMAIL",
|
|
83
|
-
height: 100,
|
|
84
|
-
width: 200,
|
|
85
|
-
});
|
|
86
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
87
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("Should replace s3 url with cdn url for email when bucket name is other than intouch_creatives_assets in case of prod.", () => {
|
|
91
|
-
localStorage.setItem("CREATIVES_S3_BUCKET_PATH", "fileservice.in/intouch_creative_assets");
|
|
92
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/fileservice.in/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
93
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
94
|
-
url: TEST_S3_URL,
|
|
95
|
-
channelName: "EMAIL",
|
|
96
|
-
height: 100,
|
|
97
|
-
width: 200,
|
|
98
|
-
});
|
|
99
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/fileservice.in/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
100
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("Should replace s3 url with cdn url for email when bucket name is other than intouch_creatives_assets in case of prod. It should remove leading/trailing forward slashes from bucket path", () => {
|
|
104
|
-
localStorage.setItem("CREATIVES_S3_BUCKET_PATH", "/fileservice.in/intouch_creative_assets/");
|
|
105
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/fileservice.in/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
106
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
107
|
-
url: TEST_S3_URL,
|
|
108
|
-
channelName: "EMAIL",
|
|
109
|
-
height: 100,
|
|
110
|
-
width: 200,
|
|
111
|
-
});
|
|
112
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/fileservice.in/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
113
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("Should replace s3 url with cdn url for email for gif formats", () => {
|
|
117
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/02557e68-6b7b-4d0e-ba6f-efcf8972.gif`;
|
|
118
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
119
|
-
url: TEST_S3_URL,
|
|
120
|
-
channelName: "EMAIL",
|
|
121
|
-
height: 100,
|
|
122
|
-
width: 200,
|
|
123
|
-
});
|
|
124
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/02557e68-6b7b-4d0e-ba6f-efcf8972.gif`;
|
|
125
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("Should replace s3 url with cdn url for email without transformation for formats other than jpg/png/jpeg/gif", () => {
|
|
129
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.avif`; //this is random url
|
|
130
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
131
|
-
url: TEST_S3_URL,
|
|
132
|
-
channelName: "EMAIL",
|
|
133
|
-
height: 100,
|
|
134
|
-
width: 200,
|
|
135
|
-
});
|
|
136
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.avif`;
|
|
137
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("should replace cdn url with new cdn url for email incase h/w etc changed", () => {
|
|
141
|
-
const TEST_S3_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
142
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
143
|
-
url: TEST_S3_URL,
|
|
144
|
-
channelName: "EMAIL",
|
|
145
|
-
height: 400,
|
|
146
|
-
width: 500,
|
|
147
|
-
});
|
|
148
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=500,height=400,format=auto,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
149
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it("should replace cdn url with new cdn url incase channelName is LINE and channelSubType is RICH_MESSAGE without transformation", () => {
|
|
153
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`;
|
|
154
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
155
|
-
url: TEST_S3_URL,
|
|
156
|
-
channelName: "LINE",
|
|
157
|
-
channelSubType: "RICH_MESSAGE",
|
|
158
|
-
});
|
|
159
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8`;
|
|
160
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("should replace cdn url with new cdn url for channels which has predefined h/w for channel", () => {
|
|
164
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
165
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
166
|
-
url: TEST_S3_URL,
|
|
167
|
-
channelName: "RCS",
|
|
168
|
-
});
|
|
169
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=1440,height=720,quality=75,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
170
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it("should return url directly if typeof CREATIVES_CDN_QUALITY_CONFIG is not object", () => {
|
|
174
|
-
localStorage.setItem("CREATIVES_CDN_QUALITY_CONFIG", "a");
|
|
175
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
176
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
177
|
-
url: TEST_S3_URL,
|
|
178
|
-
channelName: "EMAIL",
|
|
179
|
-
});
|
|
180
|
-
expect(GENERATED_CDN_URL).toEqual(TEST_S3_URL);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("should return cdn url with full quality if quality is not number", () => {
|
|
184
|
-
localStorage.setItem(
|
|
185
|
-
"CREATIVES_CDN_QUALITY_CONFIG",
|
|
186
|
-
'{"EMAIL":"a","RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}'
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
const TEST_S3_URL = `https://crm-nightly-new-fileservice.s3.amazonaws.com/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
190
|
-
const GENERATED_CDN_URL = cdnUtils.getCdnUrl({
|
|
191
|
-
url: TEST_S3_URL,
|
|
192
|
-
channelName: "EMAIL",
|
|
193
|
-
height: 100,
|
|
194
|
-
width: 200,
|
|
195
|
-
});
|
|
196
|
-
const EXPECTED_CDN_URL = `https://storage.crm.n.content-cdn.io/cdn-cgi/image/width=200,height=100,format=auto,quality=100,/intouch_creative_assets/2c9233ed-0959-4aff-b749-9171b5c8.jpg`;
|
|
197
|
-
|
|
198
|
-
expect(GENERATED_CDN_URL).toEqual(EXPECTED_CDN_URL);
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
describe("updateImagesInHtml()", () => {
|
|
203
|
-
it("should update images in html", () => {
|
|
204
|
-
const htmlContentsInput = mockdata.emailRawInput;
|
|
205
|
-
const htmlContentsOutput = cdnUtils.updateImagesInHtml(htmlContentsInput);
|
|
206
|
-
const expected = mockdata.emailRawTransformed;
|
|
207
|
-
expect(htmlContentsOutput).toEqual(expected);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("should return input itself if input is either among undefined/null/empty string", () => {
|
|
211
|
-
expect(cdnUtils.updateImagesInHtml(undefined)).toEqual(undefined);
|
|
212
|
-
expect(cdnUtils.updateImagesInHtml(null)).toEqual(null);
|
|
213
|
-
expect(cdnUtils.updateImagesInHtml("")).toEqual("");
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe("transformEmailTemplate()", () => {
|
|
218
|
-
it("should transform email template", () => {
|
|
219
|
-
const emailTemplateInput = mockdata.emailTemplateRaw;
|
|
220
|
-
const emailTemplateOutput =
|
|
221
|
-
cdnUtils.transformEmailTemplates(emailTemplateInput);
|
|
222
|
-
expect(emailTemplateOutput).toMatchSnapshot();
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe("saveCdnConfigs()", () => {
|
|
227
|
-
it("should set received input values in localStorage", () => {
|
|
228
|
-
const cdnConfigs = {
|
|
229
|
-
transformationUrlSuffix: "cdn-cgi/image",
|
|
230
|
-
hostname: "https://storage.crm.n.content-cdn.io",
|
|
231
|
-
qualityCfg: {
|
|
232
|
-
EMAIL: 75,
|
|
233
|
-
RCS: 75,
|
|
234
|
-
VIBER: 75,
|
|
235
|
-
WHATSAPP: 75,
|
|
236
|
-
MOBILE_PUSH: 75,
|
|
237
|
-
FACEBOOK: 75,
|
|
238
|
-
LINE: 75,
|
|
239
|
-
DEFAULT: 75,
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
const expected = {
|
|
244
|
-
CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX: "cdn-cgi/image",
|
|
245
|
-
CREATIVES_CDN_BASE_URL: "https://storage.crm.n.content-cdn.io",
|
|
246
|
-
CREATIVES_CDN_QUALITY_CONFIG:
|
|
247
|
-
'{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}',
|
|
248
|
-
};
|
|
249
|
-
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
250
|
-
|
|
251
|
-
expect(
|
|
252
|
-
localStorage.getItem("CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX")
|
|
253
|
-
).toBe(expected.CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX);
|
|
254
|
-
expect(localStorage.getItem("CREATIVES_CDN_BASE_URL")).toBe(
|
|
255
|
-
expected.CREATIVES_CDN_BASE_URL
|
|
256
|
-
);
|
|
257
|
-
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(
|
|
258
|
-
expected.CREATIVES_CDN_QUALITY_CONFIG
|
|
259
|
-
);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it("should clear items from localStorage if input does not contain hostname or transformationUrlSuffix", () => {
|
|
263
|
-
const cdnConfigs = {
|
|
264
|
-
qualityCfg: {
|
|
265
|
-
EMAIL: 75,
|
|
266
|
-
RCS: 75,
|
|
267
|
-
VIBER: 75,
|
|
268
|
-
WHATSAPP: 75,
|
|
269
|
-
MOBILE_PUSH: 75,
|
|
270
|
-
FACEBOOK: 75,
|
|
271
|
-
LINE: 75,
|
|
272
|
-
DEFAULT: 75,
|
|
273
|
-
},
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
const expected = {
|
|
277
|
-
CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX: "cdn-cgi/image",
|
|
278
|
-
CREATIVES_CDN_BASE_URL: "https://storage.crm.n.content-cdn.io",
|
|
279
|
-
CREATIVES_CDN_QUALITY_CONFIG:
|
|
280
|
-
'{"EMAIL":75,"RCS":75,"VIBER":75,"WHATSAPP":75,"MOBILE_PUSH":75,"FACEBOOK":75,"LINE":75,"DEFAULT":75}',
|
|
281
|
-
};
|
|
282
|
-
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
283
|
-
|
|
284
|
-
expect(
|
|
285
|
-
localStorage.getItem("CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX")
|
|
286
|
-
).toBe(undefined);
|
|
287
|
-
expect(localStorage.getItem("CREATIVES_CDN_BASE_URL")).toBe(undefined);
|
|
288
|
-
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(
|
|
289
|
-
expected.CREATIVES_CDN_QUALITY_CONFIG
|
|
290
|
-
);
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it("should clear items from localStorage if input is null or empty object", () => {
|
|
294
|
-
const cdnConfigs = {};
|
|
295
|
-
|
|
296
|
-
cdnUtils.saveCdnConfigs(cdnConfigs);
|
|
297
|
-
|
|
298
|
-
expect(
|
|
299
|
-
localStorage.getItem("CREATIVES_CDN_TRANSFORMATION_URL_SUFFIX")
|
|
300
|
-
).toBe(undefined);
|
|
301
|
-
expect(localStorage.getItem("CREATIVES_CDN_BASE_URL")).toBe(undefined);
|
|
302
|
-
expect(localStorage.getItem("CREATIVES_CDN_QUALITY_CONFIG")).toBe(undefined);
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { injectIntl } from 'react-intl';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import FormBuilder from '../index';
|
|
5
|
-
import { Provider } from 'react-redux';
|
|
6
|
-
import configureStore from '../../../store';
|
|
7
|
-
import {
|
|
8
|
-
render,
|
|
9
|
-
screen,
|
|
10
|
-
fireEvent,
|
|
11
|
-
waitFor
|
|
12
|
-
} from '../../../utils/test-utils';
|
|
13
|
-
import { mockData } from './mockData';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const ComponentToRender = injectIntl(FormBuilder);
|
|
17
|
-
const renderComponent = props => {
|
|
18
|
-
const store = configureStore({}, null);
|
|
19
|
-
return render(
|
|
20
|
-
<Provider store={store}>
|
|
21
|
-
<ComponentToRender {...props} />
|
|
22
|
-
</Provider>,
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe("test for checkbox form builder",() => {
|
|
27
|
-
const onFormValidityChange=jest.fn();
|
|
28
|
-
const props={
|
|
29
|
-
...mockData,
|
|
30
|
-
onFormValidityChange
|
|
31
|
-
}
|
|
32
|
-
renderComponent(props);
|
|
33
|
-
it("add action button to notification disabled in ios", async () => {
|
|
34
|
-
const addNotifBtn=screen.getByLabelText("Add action buttons to notification")
|
|
35
|
-
expect(addNotifBtn).toBeDisabled();
|
|
36
|
-
fireEvent.mouseOver(addNotifBtn);
|
|
37
|
-
await waitFor(() => {
|
|
38
|
-
expect(screen.getByText("This section is being revamped. Till then it will remain disabled.")).toBeInTheDocument();
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
})
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
export const mockData = {
|
|
2
|
-
schema:{
|
|
3
|
-
"containers": [
|
|
4
|
-
{
|
|
5
|
-
"id": "pane",
|
|
6
|
-
"supportedEvents": [
|
|
7
|
-
"onTabChange"
|
|
8
|
-
],
|
|
9
|
-
"panes": [
|
|
10
|
-
{
|
|
11
|
-
"isSupported": true,
|
|
12
|
-
"sectionsHeaders": [
|
|
13
|
-
{
|
|
14
|
-
"type": "multicols",
|
|
15
|
-
"inputFields": [
|
|
16
|
-
{
|
|
17
|
-
"rowStyle": {
|
|
18
|
-
"display": "flex",
|
|
19
|
-
"flex": 1
|
|
20
|
-
},
|
|
21
|
-
"cols": [
|
|
22
|
-
{
|
|
23
|
-
"id": "tab-header",
|
|
24
|
-
"metaType": "label",
|
|
25
|
-
"value": "iOS",
|
|
26
|
-
"primitive": true,
|
|
27
|
-
"dynamicTab": false,
|
|
28
|
-
"type": "div",
|
|
29
|
-
"width": 5,
|
|
30
|
-
"offset": 0,
|
|
31
|
-
"onlyDisplay": true,
|
|
32
|
-
"colStyle": {
|
|
33
|
-
"flex": 1
|
|
34
|
-
},
|
|
35
|
-
"injectedEvents": {}
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"actionFields": []
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
"sections": [
|
|
44
|
-
{
|
|
45
|
-
"type": "parent",
|
|
46
|
-
"width": 16,
|
|
47
|
-
"rowStyle": {
|
|
48
|
-
"height": "100%"
|
|
49
|
-
},
|
|
50
|
-
"childSections": [
|
|
51
|
-
{
|
|
52
|
-
"colStyle": {
|
|
53
|
-
"paddingTop": "16px",
|
|
54
|
-
"paddingLeft": "16px",
|
|
55
|
-
"borderRight": "1px solid #d9d9d9",
|
|
56
|
-
"height": "70vh",
|
|
57
|
-
"overflowY": "auto"
|
|
58
|
-
},
|
|
59
|
-
"width": 16,
|
|
60
|
-
"type": "parent",
|
|
61
|
-
"childSections": [
|
|
62
|
-
{
|
|
63
|
-
"type": "multicols",
|
|
64
|
-
"inputFields": [
|
|
65
|
-
{
|
|
66
|
-
"identifier": "add-sec-cta-ios",
|
|
67
|
-
"cols": [
|
|
68
|
-
{
|
|
69
|
-
"id": "add-sec-cta-ios",
|
|
70
|
-
"metaType": "label",
|
|
71
|
-
"dynamicTab": false,
|
|
72
|
-
"label": "Add action buttons to notification",
|
|
73
|
-
"styling": "semantic",
|
|
74
|
-
"type": "checkbox",
|
|
75
|
-
"customComponent": false,
|
|
76
|
-
"datatype": "boolean",
|
|
77
|
-
"fluid": true,
|
|
78
|
-
"onlyDisplay": false,
|
|
79
|
-
"offset": 0,
|
|
80
|
-
"colStyle": {
|
|
81
|
-
"flex": 1
|
|
82
|
-
},
|
|
83
|
-
"submitAction": "addSecondaryCtaIos",
|
|
84
|
-
"supportedEvents": [
|
|
85
|
-
"addSecondaryCtaIos"
|
|
86
|
-
],
|
|
87
|
-
"disabled": true,
|
|
88
|
-
"hoverText": "This section is being revamped. Till then it will remain disabled.",
|
|
89
|
-
"injectedEvents": {}
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"actionFields": []
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
"type": "tabs",
|
|
104
|
-
"defaultPanes": 1,
|
|
105
|
-
"additionalPanes": 0,
|
|
106
|
-
"injectedEvents": {}
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
"channel": "MOBILEPUSH",
|
|
110
|
-
"module": "Campaigns",
|
|
111
|
-
"type": "LAYOUT"
|
|
112
|
-
},
|
|
113
|
-
location:{
|
|
114
|
-
"pathname": "/mobilepush/create/image",
|
|
115
|
-
"query": {
|
|
116
|
-
"type": false,
|
|
117
|
-
"module": "default"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { injectIntl } from 'react-intl';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import { Provider } from 'react-redux';
|
|
5
|
-
import { browserHistory } from 'react-router';
|
|
6
|
-
import NewCallTask from '../index';
|
|
7
|
-
import configureStore from '../../../store';
|
|
8
|
-
import mockData from './mockData'
|
|
9
|
-
import {
|
|
10
|
-
render,
|
|
11
|
-
} from '../../../utils/test-utils';
|
|
12
|
-
import { Router } from "express";
|
|
13
|
-
const ComponentToRender = injectIntl(NewCallTask);
|
|
14
|
-
|
|
15
|
-
const renderComponent = (props) => {
|
|
16
|
-
const store = configureStore({}, browserHistory);
|
|
17
|
-
return render(
|
|
18
|
-
<Router>
|
|
19
|
-
<Provider store={store}>
|
|
20
|
-
<ComponentToRender {...props} />
|
|
21
|
-
</Provider>
|
|
22
|
-
</Router>,
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
describe("test for NewCallTask", () => {
|
|
27
|
-
const onCallTaskSubmit = jest.fn();
|
|
28
|
-
const props = {
|
|
29
|
-
...mockData,
|
|
30
|
-
onCallTaskSubmit,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
it("New call task", async () => {
|
|
34
|
-
renderComponent(props);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const mockData= {
|
|
2
|
-
injectedTags: {},
|
|
3
|
-
templateData: {},
|
|
4
|
-
messageDetails: {},
|
|
5
|
-
isLoading: true,
|
|
6
|
-
selectedOfferDetails: [],
|
|
7
|
-
location: {
|
|
8
|
-
pathname: "/NewCallTask",
|
|
9
|
-
query: {
|
|
10
|
-
type: false,
|
|
11
|
-
module: "default",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
match: {
|
|
15
|
-
path: '/NewCallTask',
|
|
16
|
-
url: '/creatives/ui/v2',
|
|
17
|
-
isExact: true,
|
|
18
|
-
params: {},
|
|
19
|
-
}
|
|
20
|
-
}
|