@capillarytech/creatives-library 8.0.113 → 8.0.114-alpha.1
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/containers/App/test/saga.test.js +1 -1
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/containers/Assets/Gallery/tests/saga.test.js +9 -9
- package/containers/Dashboard/test/saga.test.js +1 -1
- package/containers/Ebill/test/saga.test.js +1 -1
- package/containers/Email/test/saga.test.js +33 -33
- package/containers/LanguageProvider/tests/actions.test.js +1 -1
- package/containers/LanguageProvider/tests/reducer.test.js +2 -2
- package/containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/containers/Line/Create/tests/saga.test.js +2 -9
- package/containers/Line/Edit/test/saga.test.js +10 -14
- package/containers/MobilePush/Create/test/saga.test.js +2 -2
- package/containers/MobilePush/Edit/tests/saga.test.js +14 -14
- package/containers/Sms/Create/test/saga.test.js +4 -5
- package/containers/Sms/Edit/test/saga.test.js +1 -1
- package/containers/Templates/test/saga.test.js +14 -17
- package/containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/package.json +1 -1
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -9
- package/utils/commonUtils.js +359 -3
- package/utils/tagValidations.js +20 -5
- package/utils/tests/authWrapper.test.js +2 -2
- package/utils/tests/cdnTransformation.test.js +16 -15
- package/utils/tests/commonUtil.test.js +474 -171
- package/utils/tests/tagValidations.test.js +89 -2
- package/v2Components/CapVideoUpload/tests/index.test.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +1 -2
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +127 -0
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +147 -0
- package/v2Components/ErrorInfoNote/index.js +114 -46
- package/v2Components/ErrorInfoNote/messages.js +25 -0
- package/v2Components/ErrorInfoNote/style.scss +14 -1
- package/v2Components/ErrorInfoNote/utils.js +38 -0
- package/v2Components/ErrorInfoNote/utils.test.js +156 -0
- package/v2Components/FormBuilder/index.js +204 -127
- package/v2Components/FormBuilder/messages.js +1 -1
- package/v2Components/MarketingObjective/test/index.test.js +1 -1
- package/v2Components/NavigationBar/tests/saga.test.js +2 -3
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/v2Containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/v2Containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/v2Containers/Assets/Gallery/tests/saga.test.js +2 -2
- package/v2Containers/BeeEditor/test/saga.test.js +1 -1
- package/v2Containers/CallTask/test/saga.test.js +1 -1
- package/v2Containers/Cap/reducer.js +4 -4
- package/v2Containers/Cap/tests/actions.test.js +1 -1
- package/v2Containers/Cap/tests/reducer.test.js +11 -11
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Cap/tests/selectors.test.js +3 -3
- package/v2Containers/CapFacebookPreview/tests/saga.test.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +23 -3
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +3 -1
- package/v2Containers/CreativesContainer/constants.js +4 -1
- package/v2Containers/CreativesContainer/index.js +44 -19
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -3
- package/v2Containers/Ebill/index.js +3 -3
- package/v2Containers/Ebill/test/saga.test.js +1 -1
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +4 -4
- package/v2Containers/Email/tests/actions.test.js +1 -1
- package/v2Containers/Email/tests/reducer.test.js +2 -2
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +1 -1
- package/v2Containers/FTP/test/saga.test.js +1 -1
- package/v2Containers/Facebook/test/saga.test.js +7 -7
- package/v2Containers/InApp/index.js +123 -50
- package/v2Containers/InApp/tests/action.test.js +7 -7
- package/v2Containers/InApp/tests/index.test.js +2 -4
- package/v2Containers/InApp/tests/reducer.test.js +175 -89
- package/v2Containers/InApp/tests/sagas.test.js +1 -1
- package/v2Containers/InApp/tests/utils.test.js +41 -0
- package/v2Containers/InApp/utils.js +37 -0
- package/v2Containers/LanguageProvider/tests/actions.test.js +1 -1
- package/v2Containers/LanguageProvider/tests/reducer.test.js +3 -3
- package/v2Containers/LanguageProvider/tests/saga.test.js +2 -2
- package/v2Containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +3 -3
- package/v2Containers/Line/Container/Sticker/tests/utils.test.js +6 -6
- package/v2Containers/MobilePush/Create/index.js +24 -20
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/MobilePush/Edit/index.js +6 -2
- package/v2Containers/MobilePush/Edit/test/saga.test.js +14 -14
- package/v2Containers/MobilepushWrapper/index.js +2 -0
- package/v2Containers/Rcs/tests/saga.test.js +1 -1
- package/v2Containers/Sms/Create/index.js +1 -0
- package/v2Containers/Sms/Create/test/saga.test.js +1 -1
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/Sms/Edit/test/saga.test.js +5 -5
- package/v2Containers/SmsTrai/Create/tests/saga.test.js +1 -1
- package/v2Containers/SmsTrai/Create/tests/selectors.test.js +1 -1
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/tests/TagList.test.js +1 -3
- package/v2Containers/TagList/tests/utils.test.js +3 -3
- package/v2Containers/Templates/tests/actions.test.js +1 -1
- package/v2Containers/Templates/tests/reducer.test.js +8 -8
- package/v2Containers/Templates/tests/sagas.test.js +2 -4
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/v2Containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +9 -9
- package/v2Containers/Whatsapp/tests/actions.test.js +3 -3
- package/v2Containers/Whatsapp/tests/reducer.test.js +32 -36
- package/v2Containers/Whatsapp/tests/utils.test.js +19 -19
- package/v2Containers/Zalo/tests/actions.test.js +3 -3
- package/v2Containers/Zalo/tests/reducer.test.js +72 -42
|
@@ -6,171 +6,257 @@ import * as types from "../constants";
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
describe("zalo reducer", () => {
|
|
9
|
-
let state;
|
|
10
|
-
const action = {};
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
state = fromJS({
|
|
13
|
-
uploadedAssetData: {},
|
|
14
|
-
createTemplateInProgress: false,
|
|
15
|
-
editTemplateInProgress: false,
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
9
|
describe("Reducer : INAPP_TEMPLATE_CREATE_REQUEST", () => {
|
|
20
|
-
it("should handle INAPP_TEMPLATE_CREATE_REQUEST action", () => {
|
|
21
|
-
state =
|
|
10
|
+
it.concurrent("should handle INAPP_TEMPLATE_CREATE_REQUEST action", () => {
|
|
11
|
+
const state = fromJS({
|
|
12
|
+
uploadedAssetData: {},
|
|
13
|
+
createTemplateInProgress: false,
|
|
14
|
+
editTemplateInProgress: false,
|
|
15
|
+
});
|
|
16
|
+
const expectedResult = state
|
|
22
17
|
.set("createTemplateInProgress", true)
|
|
23
18
|
.set("createTemplateError", false)
|
|
24
19
|
.set("createTemplateErrorMessage", "");
|
|
25
|
-
|
|
26
|
-
expect(inAppReducer(state, actions.createInAppTemplate({}))).toEqual(
|
|
27
|
-
expectedResult
|
|
28
|
-
);
|
|
20
|
+
expect(inAppReducer(state, actions.createInAppTemplate({}))).toEqual(expectedResult);
|
|
29
21
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
|
|
23
|
+
it.concurrent("should handle INAPP_TEMPLATE_CREATE_SUCCESS action", () => {
|
|
24
|
+
const state = fromJS({
|
|
25
|
+
uploadedAssetData: {},
|
|
26
|
+
createTemplateInProgress: false,
|
|
27
|
+
editTemplateInProgress: false,
|
|
28
|
+
});
|
|
29
|
+
const action = {
|
|
30
|
+
type: types.INAPP_TEMPLATE_CREATE_SUCCESS,
|
|
31
|
+
data: 'data',
|
|
32
|
+
};
|
|
33
|
+
const expectedResult = state
|
|
34
34
|
.set("createTemplateInProgress", false)
|
|
35
35
|
.set("createTemplateError", false)
|
|
36
36
|
.set("createTemplateErrorMessage", undefined)
|
|
37
37
|
.set('response', 'data');
|
|
38
|
-
const expectedResult = state;
|
|
39
38
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
40
39
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
|
|
41
|
+
it.concurrent("should handle INAPP_TEMPLATE_CREATE_FAILURE action", () => {
|
|
42
|
+
const state = fromJS({
|
|
43
|
+
uploadedAssetData: {},
|
|
44
|
+
createTemplateInProgress: false,
|
|
45
|
+
editTemplateInProgress: false,
|
|
46
|
+
});
|
|
47
|
+
const action = {
|
|
48
|
+
type: types.INAPP_TEMPLATE_CREATE_FAILURE,
|
|
49
|
+
errorMsg: 'error',
|
|
50
|
+
};
|
|
51
|
+
const expectedResult = state
|
|
45
52
|
.set("createTemplateInProgress", false)
|
|
46
53
|
.set('createTemplateError', true)
|
|
47
54
|
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
48
|
-
const expectedResult = state;
|
|
49
55
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
50
56
|
});
|
|
51
57
|
});
|
|
52
58
|
describe("Reducer : INAPP_EDIT_TEMPLATE_REQUEST", () => {
|
|
53
|
-
it("should handle INAPP_EDIT_TEMPLATE_REQUEST action", () => {
|
|
54
|
-
state =
|
|
59
|
+
it.concurrent("should handle INAPP_EDIT_TEMPLATE_REQUEST action", () => {
|
|
60
|
+
const state = fromJS({
|
|
61
|
+
uploadedAssetData: {},
|
|
62
|
+
createTemplateInProgress: false,
|
|
63
|
+
editTemplateInProgress: false,
|
|
64
|
+
});
|
|
65
|
+
const expectedResult = state
|
|
55
66
|
.set("editTemplateInProgress", true)
|
|
56
67
|
.set("editTemplateError", false)
|
|
57
68
|
.set("editTemplateErrorMessage", "");
|
|
58
|
-
const expectedResult = state;
|
|
59
69
|
expect(inAppReducer(state, actions.editTemplate({}))).toEqual(
|
|
60
70
|
expectedResult
|
|
61
71
|
);
|
|
62
72
|
});
|
|
63
|
-
it("should handle INAPP_EDIT_TEMPLATE_SUCCESS action", () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
it.concurrent("should handle INAPP_EDIT_TEMPLATE_SUCCESS action", () => {
|
|
74
|
+
const state = fromJS({
|
|
75
|
+
uploadedAssetData: {},
|
|
76
|
+
createTemplateInProgress: false,
|
|
77
|
+
editTemplateInProgress: false,
|
|
78
|
+
});
|
|
79
|
+
const action = {
|
|
80
|
+
type: types.INAPP_EDIT_TEMPLATE_SUCCESS,
|
|
81
|
+
data: 'data',
|
|
82
|
+
statusCode: 200,
|
|
83
|
+
};
|
|
84
|
+
const expectedResult = state
|
|
68
85
|
.set("editTemplateInProgress", false)
|
|
69
86
|
.set("editTemplateError", false)
|
|
70
|
-
.set("editTemplateErrorMessage",
|
|
87
|
+
.set("editTemplateErrorMessage", undefined)
|
|
71
88
|
.set('editResponse', 'data');
|
|
72
|
-
const expectedResult = state;
|
|
73
89
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
74
90
|
});
|
|
75
|
-
it("should handle INAPP_EDIT_TEMPLATE_FAILURE action", () => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
91
|
+
it.concurrent("should handle INAPP_EDIT_TEMPLATE_FAILURE action", () => {
|
|
92
|
+
const state = fromJS({
|
|
93
|
+
uploadedAssetData: {},
|
|
94
|
+
createTemplateInProgress: false,
|
|
95
|
+
editTemplateInProgress: false,
|
|
96
|
+
});
|
|
97
|
+
const action = {
|
|
98
|
+
type: types.INAPP_EDIT_TEMPLATE_FAILURE,
|
|
99
|
+
errorMsg: 'error',
|
|
100
|
+
};
|
|
101
|
+
const expectedResult = state
|
|
79
102
|
.set("editTemplateInProgress", false)
|
|
80
103
|
.set('editTemplateError', true)
|
|
81
104
|
.set('editTemplateErrorMessage', fromJS(action.errorMsg));
|
|
82
|
-
const expectedResult = state;
|
|
83
105
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
84
106
|
});
|
|
85
107
|
|
|
86
|
-
it("should handle default action", () => {
|
|
87
|
-
|
|
108
|
+
it.concurrent("should handle default action", () => {
|
|
109
|
+
const state = fromJS({
|
|
110
|
+
uploadedAssetData: {},
|
|
111
|
+
createTemplateInProgress: false,
|
|
112
|
+
editTemplateInProgress: false,
|
|
113
|
+
});
|
|
114
|
+
const action = {
|
|
115
|
+
type: "deafult_action",
|
|
116
|
+
};
|
|
88
117
|
const expectedResult = state;
|
|
89
118
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
90
119
|
});
|
|
91
120
|
});
|
|
92
121
|
describe("Reducer : GET_TEMPLATE_DETAILS_REQUEST", () => {
|
|
93
|
-
it("should handle GET_TEMPLATE_DETAILS_REQUEST action", () => {
|
|
94
|
-
state =
|
|
95
|
-
|
|
122
|
+
it.concurrent("should handle GET_TEMPLATE_DETAILS_REQUEST action", () => {
|
|
123
|
+
const state = fromJS({
|
|
124
|
+
uploadedAssetData: {},
|
|
125
|
+
createTemplateInProgress: false,
|
|
126
|
+
editTemplateInProgress: false,
|
|
127
|
+
getTemplateDetailsInProgress: true,
|
|
128
|
+
});
|
|
96
129
|
const expectedResult = state;
|
|
97
130
|
expect(inAppReducer(state, actions.getTemplateDetails({}))).toEqual(
|
|
98
131
|
expectedResult
|
|
99
132
|
);
|
|
100
133
|
});
|
|
101
|
-
it("should handle INAPP_EDIT_TEMPLATE_SUCCESS action", () => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
it.concurrent("should handle INAPP_EDIT_TEMPLATE_SUCCESS action", () => {
|
|
135
|
+
const state = fromJS({
|
|
136
|
+
uploadedAssetData: {},
|
|
137
|
+
createTemplateInProgress: false,
|
|
138
|
+
editTemplateInProgress: false,
|
|
139
|
+
getTemplateDetailsInProgress: false,
|
|
140
|
+
templateDetails: 'data',
|
|
141
|
+
});
|
|
142
|
+
const action = {
|
|
143
|
+
type: types.GET_INAPP_TEMPLATE_DETAILS_SUCCESS,
|
|
144
|
+
data: 'data',
|
|
145
|
+
statusCode: 200,
|
|
146
|
+
};
|
|
108
147
|
const expectedResult = state;
|
|
109
148
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
110
149
|
});
|
|
111
|
-
it("should handle GET_TEMPLATE_DETAILS_FAILURE action", () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
it.concurrent("should handle GET_TEMPLATE_DETAILS_FAILURE action", () => {
|
|
151
|
+
const state = fromJS({
|
|
152
|
+
uploadedAssetData: {},
|
|
153
|
+
createTemplateInProgress: false,
|
|
154
|
+
editTemplateInProgress: false,
|
|
155
|
+
getTemplateDetailsInProgress: false,
|
|
156
|
+
});
|
|
157
|
+
const action = {
|
|
158
|
+
type: types.GET_INAPP_TEMPLATE_DETAILS_FAILURE,
|
|
159
|
+
errorMsg: 'error',
|
|
160
|
+
};
|
|
116
161
|
const expectedResult = state;
|
|
117
162
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
118
163
|
});
|
|
119
|
-
it("should handle CLEAR_CREATE_RESPONSE_REQUEST action", () => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
164
|
+
it.concurrent("should handle CLEAR_CREATE_RESPONSE_REQUEST action", () => {
|
|
165
|
+
const state = fromJS({
|
|
166
|
+
uploadedAssetData: {},
|
|
167
|
+
createTemplateInProgress: false,
|
|
168
|
+
editTemplateInProgress: false,
|
|
169
|
+
response: {},
|
|
170
|
+
});
|
|
171
|
+
const action = {
|
|
172
|
+
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
173
|
+
};
|
|
174
|
+
const expectedResult = state.set("response", {});
|
|
124
175
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
125
176
|
});
|
|
126
|
-
it("should handle RESET_EDIT_TEMPLATE action", () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
177
|
+
it.concurrent("should handle RESET_EDIT_TEMPLATE action", () => {
|
|
178
|
+
const state = fromJS({
|
|
179
|
+
uploadedAssetData: {},
|
|
180
|
+
createTemplateInProgress: false,
|
|
181
|
+
editTemplateInProgress: false,
|
|
182
|
+
templateDetails: {},
|
|
183
|
+
});
|
|
184
|
+
const action = {
|
|
185
|
+
type: types.RESET_EDIT_TEMPLATE,
|
|
186
|
+
};
|
|
187
|
+
const expectedResult = state.set("templateDetails", {});
|
|
131
188
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
132
189
|
});
|
|
133
190
|
});
|
|
134
191
|
describe("Reducer : UPLOAD_INAPP_ASSET_REQUEST", () => {
|
|
135
|
-
it("should handle UPLOAD_INAPP_ASSET_REQUEST action", () => {
|
|
136
|
-
state =
|
|
137
|
-
|
|
138
|
-
|
|
192
|
+
it.concurrent("should handle UPLOAD_INAPP_ASSET_REQUEST action", () => {
|
|
193
|
+
const state = fromJS({
|
|
194
|
+
uploadedAssetData: {},
|
|
195
|
+
createTemplateInProgress: false,
|
|
196
|
+
editTemplateInProgress: false,
|
|
197
|
+
uploadAssetSuccess: false,
|
|
198
|
+
assetUploading: true,
|
|
199
|
+
});
|
|
139
200
|
const expectedResult = state;
|
|
140
201
|
expect(inAppReducer(state, actions.uploadInAppAsset({}))).toEqual(
|
|
141
202
|
expectedResult
|
|
142
203
|
);
|
|
143
204
|
});
|
|
144
|
-
it("should handle UPLOAD_INAPP_ASSET_SUCCESS action", () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
205
|
+
it.concurrent("should handle UPLOAD_INAPP_ASSET_SUCCESS action", () => {
|
|
206
|
+
const state = fromJS({
|
|
207
|
+
uploadedAssetData: {},
|
|
208
|
+
createTemplateInProgress: false,
|
|
209
|
+
editTemplateInProgress: false,
|
|
210
|
+
getTemplateDetailsInProgress: false,
|
|
211
|
+
assetUploading: false,
|
|
212
|
+
uploadAssetSuccess: false,
|
|
213
|
+
});
|
|
214
|
+
const action = {
|
|
215
|
+
type: types.UPLOAD_INAPP_ASSET_SUCCESS,
|
|
216
|
+
data: 'data',
|
|
217
|
+
statusCode: 200,
|
|
218
|
+
};
|
|
219
|
+
const expectedResult = state
|
|
149
220
|
.set("getTemplateDetailsInProgress", false)
|
|
150
221
|
.set('assetUploading', false)
|
|
151
222
|
.set('uploadAssetSuccess', true)
|
|
152
223
|
.set('uploadedAssetData', 'data');
|
|
153
|
-
const expectedResult = state;
|
|
154
224
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
155
225
|
});
|
|
156
|
-
it("should handle UPLOAD_INAPP_ASSET_FAILURE action", () => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
226
|
+
it.concurrent("should handle UPLOAD_INAPP_ASSET_FAILURE action", () => {
|
|
227
|
+
const state = fromJS({
|
|
228
|
+
uploadedAssetData: {},
|
|
229
|
+
createTemplateInProgress: false,
|
|
230
|
+
editTemplateInProgress: false,
|
|
231
|
+
uploadAssetSuccess: false,
|
|
232
|
+
assetUploading: false,
|
|
233
|
+
});
|
|
234
|
+
const action = {
|
|
235
|
+
type: types.UPLOAD_INAPP_ASSET_FAILURE,
|
|
236
|
+
errorMsg: 'error',
|
|
237
|
+
};
|
|
238
|
+
const expectedResult = state
|
|
160
239
|
.set("assetUploading", false)
|
|
161
240
|
.set('uploadAssetSuccess', false);
|
|
162
|
-
const expectedResult = state;
|
|
163
241
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
164
242
|
});
|
|
165
|
-
it("should handle CLEAR_INAPP_ASSET action", () => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
243
|
+
it.concurrent("should handle CLEAR_INAPP_ASSET action", () => {
|
|
244
|
+
const state = fromJS({
|
|
245
|
+
uploadedAssetData: {},
|
|
246
|
+
createTemplateInProgress: false,
|
|
247
|
+
editTemplateInProgress: false,
|
|
248
|
+
assetUploading: false,
|
|
249
|
+
uploadAssetSuccess: false,
|
|
250
|
+
});
|
|
251
|
+
const action = {
|
|
252
|
+
type: types.CLEAR_INAPP_ASSET,
|
|
253
|
+
errorMsg: 'error',
|
|
254
|
+
data: 'data',
|
|
255
|
+
};
|
|
256
|
+
const expectedResult = state
|
|
170
257
|
.set("assetUploading", false)
|
|
171
258
|
.delete('uploadedAssetData', {})
|
|
172
259
|
.set('uploadAssetSuccess', false);
|
|
173
|
-
const expectedResult = state;
|
|
174
260
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
175
261
|
});
|
|
176
262
|
});
|
|
@@ -387,7 +387,7 @@ describe('test for getTemplateDetails', () => {
|
|
|
387
387
|
expect(gen.next().value).toEqual(
|
|
388
388
|
takeLatest(types.GET_INAPP_TEMPLATE_DETAILS_REQUEST, sagas.getTemplateDetails),
|
|
389
389
|
);
|
|
390
|
-
|
|
390
|
+
|
|
391
391
|
// Pass the mock task to the takeLatest effect
|
|
392
392
|
expect(gen.next(mockTask).done).toBe(true);
|
|
393
393
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { hasPlatformErrors } from "../utils";
|
|
2
|
+
|
|
3
|
+
describe("hasPlatformErrors", () => {
|
|
4
|
+
it("Happy case for hasPlatformErrors", () => {
|
|
5
|
+
const result = hasPlatformErrors();
|
|
6
|
+
expect(result).toBe(false);
|
|
7
|
+
});
|
|
8
|
+
it("returns false when called with no arguments", () => {
|
|
9
|
+
expect(hasPlatformErrors()).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("returns false when given null or undefined", () => {
|
|
13
|
+
expect(hasPlatformErrors(null)).toBe(false);
|
|
14
|
+
expect(hasPlatformErrors(undefined)).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("returns false for empty error groups", () => {
|
|
18
|
+
const emptyGroup = { ANDROID: [], IOS: [], GENERIC: [] };
|
|
19
|
+
expect(hasPlatformErrors(emptyGroup)).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("detects Android errors", () => {
|
|
23
|
+
const data = { ANDROID: ["e1"], IOS: [], GENERIC: [] };
|
|
24
|
+
expect(hasPlatformErrors(data)).toBe(true);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("detects iOS errors", () => {
|
|
28
|
+
const data = { ANDROID: [], IOS: ["e1"], GENERIC: [] };
|
|
29
|
+
expect(hasPlatformErrors(data)).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("detects generic errors", () => {
|
|
33
|
+
const data = { ANDROID: [], IOS: [], GENERIC: ["e1"] };
|
|
34
|
+
expect(hasPlatformErrors(data)).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("detects mixed platform errors", () => {
|
|
38
|
+
const data = { ANDROID: ["a"], IOS: ["i"], GENERIC: [] };
|
|
39
|
+
expect(hasPlatformErrors(data)).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -10,3 +10,40 @@ export const getCtaObject = (ctaData) =>
|
|
|
10
10
|
};
|
|
11
11
|
return obj;
|
|
12
12
|
});
|
|
13
|
+
|
|
14
|
+
// Helper functions to check for errors
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a platform-specific error group (like STANDARD_ERROR_MSG or LIQUID_ERROR_MSG)
|
|
17
|
+
* contains any errors for ANDROID, IOS, or GENERIC platforms.
|
|
18
|
+
*
|
|
19
|
+
* @param {object} platformErrorGroup - The error group object (e.g., errorMessage.STANDARD_ERROR_MSG).
|
|
20
|
+
* @returns {boolean} True if any platform has errors, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export const hasPlatformErrors = (platformErrorGroup) => {
|
|
23
|
+
if (!platformErrorGroup) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return (
|
|
27
|
+
platformErrorGroup.ANDROID?.length > 0
|
|
28
|
+
|| platformErrorGroup.IOS?.length > 0
|
|
29
|
+
|| platformErrorGroup.GENERIC?.length > 0
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks the main errorMessage object for any standard or liquid errors
|
|
36
|
+
* across all supported platforms.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} errorMessage - The main error object.
|
|
39
|
+
* @returns {boolean} True if any errors are present, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export const hasAnyErrors = (errorMessage) => {
|
|
42
|
+
if (!errorMessage) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
hasPlatformErrors(errorMessage.STANDARD_ERROR_MSG)
|
|
47
|
+
|| hasPlatformErrors(errorMessage.LIQUID_ERROR_MSG)
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
describe('LanguageProvider actions', () => {
|
|
10
10
|
describe('Change Local Action', () => {
|
|
11
|
-
|
|
11
|
+
test.concurrent('has a type of CHANGE_LOCALE', () => {
|
|
12
12
|
const expected = {
|
|
13
13
|
type: CHANGE_LOCALE,
|
|
14
14
|
locale: 'de',
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '../constants';
|
|
8
8
|
|
|
9
9
|
describe('languageProviderReducer', () => {
|
|
10
|
-
it('returns the initial state', () => {
|
|
10
|
+
it.concurrent('returns the initial state', () => {
|
|
11
11
|
expect(languageProviderReducer(undefined, {})).toEqual(fromJS({
|
|
12
12
|
locale: 'en',
|
|
13
13
|
languageLocale: 'en',
|
|
@@ -16,7 +16,7 @@ describe('languageProviderReducer', () => {
|
|
|
16
16
|
}));
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it('changes the locale', () => {
|
|
19
|
+
it.concurrent('changes the locale', () => {
|
|
20
20
|
expect(languageProviderReducer(undefined, { type: CHANGE_LOCALE, locale: 'en', languageLocale: 'en' }).toJS()).toEqual({
|
|
21
21
|
locale: "en",
|
|
22
22
|
languageLocale: "en",
|
|
@@ -25,7 +25,7 @@ describe('languageProviderReducer', () => {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
it('make locize message request', () => {
|
|
28
|
+
it.concurrent('make locize message request', () => {
|
|
29
29
|
expect(languageProviderReducer(undefined, { type: GET_LOCIZ_MESSAGE_REQUEST, locale: 'en', languageLocale: 'en' }).toJS()).toEqual({
|
|
30
30
|
locale: "en",
|
|
31
31
|
languageLocale: 'en',
|
|
@@ -9,7 +9,7 @@ describe('getLocizMessage saga', () => {
|
|
|
9
9
|
const locale = 'en-US';
|
|
10
10
|
const action = { locale };
|
|
11
11
|
|
|
12
|
-
it('handles successful API call', () => {
|
|
12
|
+
it.concurrent('handles successful API call', () => {
|
|
13
13
|
const response = { messages: { hello: "Hello" } }; // Example response structure
|
|
14
14
|
|
|
15
15
|
return expectSaga(getLocizMessage, action)
|
|
@@ -24,7 +24,7 @@ describe('getLocizMessage saga', () => {
|
|
|
24
24
|
.run();
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('handles failure when API call fails', () => {
|
|
27
|
+
it.concurrent('handles failure when API call fails', () => {
|
|
28
28
|
const error = new Error('Failed to fetch localization messages');
|
|
29
29
|
|
|
30
30
|
return expectSaga(getLocizMessage, action)
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '../selectors';
|
|
6
6
|
|
|
7
7
|
describe('selectLanguage', () => {
|
|
8
|
-
it('should select the global state', () => {
|
|
8
|
+
it.concurrent('should select the global state', () => {
|
|
9
9
|
const globalState = fromJS({});
|
|
10
10
|
const mockedState = fromJS({
|
|
11
11
|
language: globalState,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { calculateAspectRatio } from '../utils';
|
|
2
2
|
|
|
3
3
|
describe('calculateAspectRatio -- Test', () => {
|
|
4
|
-
it('Should return aspect ratio 1:1', () =>
|
|
4
|
+
it.concurrent('Should return aspect ratio 1:1', () =>
|
|
5
5
|
expect(calculateAspectRatio(400, 400)).toEqual('1:1'));
|
|
6
|
-
it('Should return aspect ratio 1:2', () =>
|
|
6
|
+
it.concurrent('Should return aspect ratio 1:2', () =>
|
|
7
7
|
expect(calculateAspectRatio(400, 800)).toEqual('1:2'));
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
describe('calculateGCD -- Test', () => {
|
|
11
|
-
it('Should return gcd', () =>
|
|
11
|
+
it.concurrent('Should return gcd', () =>
|
|
12
12
|
expect(calculateAspectRatio(400, 400)).toEqual('1:1'));
|
|
13
13
|
});
|
|
@@ -9,29 +9,29 @@ import {
|
|
|
9
9
|
} from './mockData';
|
|
10
10
|
|
|
11
11
|
describe('groupLineStickers', () => {
|
|
12
|
-
it('should return empty object when input is empty', () => {
|
|
12
|
+
it.concurrent('should return empty object when input is empty', () => {
|
|
13
13
|
expect(groupLineStickers(emptyInputs.emptyObject)).toEqual(emptyInputs.expectedOutput);
|
|
14
14
|
expect(groupLineStickers(emptyInputs.nullInput)).toEqual(emptyInputs.expectedOutput);
|
|
15
15
|
expect(groupLineStickers(emptyInputs.undefinedInput)).toEqual(emptyInputs.expectedOutput);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
it('should handle input with no valid packageIds', () => {
|
|
18
|
+
it.concurrent('should handle input with no valid packageIds', () => {
|
|
19
19
|
expect(groupLineStickers(noValidPackageIdsInput.input)).toEqual(noValidPackageIdsInput.expectedOutput);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it('should group stickers by packageId within single category', () => {
|
|
22
|
+
it.concurrent('should group stickers by packageId within single category', () => {
|
|
23
23
|
expect(groupLineStickers(singleCategoryInput.input)).toEqual(singleCategoryInput.expectedOutput);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('should group stickers by packageId across multiple categories', () => {
|
|
26
|
+
it.concurrent('should group stickers by packageId across multiple categories', () => {
|
|
27
27
|
expect(groupLineStickers(multipleCategoriesInput.input)).toEqual(multipleCategoriesInput.expectedOutput);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it('should skip non-array categories', () => {
|
|
30
|
+
it.concurrent('should skip non-array categories', () => {
|
|
31
31
|
expect(groupLineStickers(nonArrayCategoriesInput.input)).toEqual(nonArrayCategoriesInput.expectedOutput);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
it('should handle mixed valid and invalid sticker data', () => {
|
|
34
|
+
it.concurrent('should handle mixed valid and invalid sticker data', () => {
|
|
35
35
|
expect(groupLineStickers(mixedStickerDataInput.input)).toEqual(mixedStickerDataInput.expectedOutput);
|
|
36
36
|
});
|
|
37
37
|
});
|
|
@@ -208,7 +208,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
208
208
|
formData: newFormData,
|
|
209
209
|
tabCount,
|
|
210
210
|
isSchemaChanged:
|
|
211
|
-
compareValue
|
|
211
|
+
compareValue?.toLowerCase() === EXTERNAL_LINK_LOWERCASE ||
|
|
212
212
|
!this.state?.isSchemaChanged,
|
|
213
213
|
},
|
|
214
214
|
() => {
|
|
@@ -386,6 +386,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
386
386
|
return response;
|
|
387
387
|
};
|
|
388
388
|
setFormValidity = (isFormValid, errorData) => {
|
|
389
|
+
|
|
389
390
|
const newState = {isFormValid, errorData};
|
|
390
391
|
this.setState(newState);
|
|
391
392
|
};
|
|
@@ -1485,26 +1486,26 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1485
1486
|
} = obj || {};
|
|
1486
1487
|
const label = this.props.location.pathname.indexOf('image') >= 0 ? 'image' : 'text';
|
|
1487
1488
|
this.props.actions.createTemplate(obj, (response) => {
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1489
|
+
const timeTaken = GA.timeTracker.stopTimer(TRACK_CREATE_MPUSH, {
|
|
1490
|
+
category: 'Creatives',
|
|
1491
|
+
action: TRACK_CREATE_MPUSH,
|
|
1492
|
+
label,
|
|
1493
|
+
});
|
|
1494
|
+
gtmPush('creativeDetails', {
|
|
1495
|
+
id: response.templateId,
|
|
1496
|
+
name: obj.name,
|
|
1497
|
+
channel: MOBILE_PUSH,
|
|
1498
|
+
timeTaken,
|
|
1499
|
+
content,
|
|
1500
|
+
mode: CREATE,
|
|
1501
|
+
imageAdded: definitionMode === 'image',
|
|
1502
|
+
});
|
|
1502
1503
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1504
|
+
this.discardValues();
|
|
1505
|
+
const message = this.props.intl.formatMessage(messages.messageCreateSuccess);
|
|
1506
|
+
CapNotification.success({message, key: 'createMpushSuccess'});
|
|
1507
|
+
this.props.actions.clearCreateResponse();
|
|
1508
|
+
this.props.getFormLibraryData({validity: true});
|
|
1508
1509
|
});
|
|
1509
1510
|
};
|
|
1510
1511
|
deleteSecondaryCtaIos = (callback) => {
|
|
@@ -1776,7 +1777,9 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1776
1777
|
<CapRow>
|
|
1777
1778
|
<CapColumn>
|
|
1778
1779
|
<FormBuilder
|
|
1780
|
+
channel={MOBILE_PUSH}
|
|
1779
1781
|
key={"form builder"}
|
|
1782
|
+
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
1780
1783
|
schema={this.state.schema}
|
|
1781
1784
|
onSubmit={this.saveFormData}
|
|
1782
1785
|
onChange={this.onFormDataChange}
|
|
@@ -1902,6 +1905,7 @@ Create.propTypes = {
|
|
|
1902
1905
|
onPreviewContentClicked: PropTypes.func,
|
|
1903
1906
|
onTestContentClicked: PropTypes.func,
|
|
1904
1907
|
eventContextTags: PropTypes.array,
|
|
1908
|
+
showLiquidErrorInFooter: PropTypes.func,
|
|
1905
1909
|
};
|
|
1906
1910
|
|
|
1907
1911
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
|
|
8
8
|
describe("MPUSH Sagas", () => {
|
|
9
9
|
describe("v2MobilePushCreateSagas Combined", () => {
|
|
10
|
-
it("should initialize all mpush-related watcher sagas without error", () => {
|
|
10
|
+
it.concurrent("should initialize all mpush-related watcher sagas without error", () => {
|
|
11
11
|
return expectSaga(v2MobilePushCreateSagas).run();
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
describe("v2MobilePushWatchDuplicateTemplateSaga Combined", () => {
|
|
15
|
-
it("should initialize all mpush-related watcher sagas without error", () => {
|
|
15
|
+
it.concurrent("should initialize all mpush-related watcher sagas without error", () => {
|
|
16
16
|
return expectSaga(v2MobilePushWatchDuplicateTemplateSaga).run();
|
|
17
17
|
});
|
|
18
18
|
});
|