@capillarytech/creatives-library 8.0.340-0 → 8.0.340-beta.0
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/app.js +8 -1
- package/global-styles.js +4 -0
- package/package.json +2 -2
- package/styles/components/navigation/_leftnav.scss +1 -1
- package/v2Components/AccessForbidden/index.js +1 -1
- package/v2Components/CapActionButton/index.js +5 -5
- package/v2Components/CapCustomSkeleton/index.js +1 -1
- package/v2Components/CapDeviceContent/index.js +5 -5
- package/v2Components/CapDocumentUpload/index.js +1 -1
- package/v2Components/CapImageUpload/index.js +1 -1
- package/v2Components/CapInAppCTA/index.js +118 -112
- package/v2Components/CapMpushCTA/index.js +72 -66
- package/v2Components/CapTagList/index.js +5 -5
- package/v2Components/CapVideoUpload/index.js +1 -1
- package/v2Components/CapWhatsappCTA/index.js +128 -124
- package/v2Components/CapWhatsappCarouselButton/index.js +27 -29
- package/v2Components/CapWhatsappQuickReply/index.js +7 -7
- package/v2Components/Carousel/index.js +1 -1
- package/v2Components/CommonTestAndPreview/AddTestCustomer.js +1 -1
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +3 -3
- package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +1 -1
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +4 -4
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +1 -1
- package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +6 -6
- package/v2Components/CommonTestAndPreview/LeftPanelContent.js +5 -5
- package/v2Components/CommonTestAndPreview/PreviewSection.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/DeviceFrame.js +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/EmailPreviewContent.js +8 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/InAppPreviewContent.js +14 -13
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +22 -21
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +9 -9
- package/v2Components/CommonTestAndPreview/UnifiedPreview/SmsPreviewContent.js +8 -8
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +10 -10
- package/v2Components/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +13 -12
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ZaloPreviewContent.js +4 -3
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +1 -1
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +3 -4
- package/v2Components/CommonTestAndPreview/index.js +1 -1
- package/v2Components/CustomerSearchSection/_customerSearch.scss +2 -1
- package/v2Components/CustomerSearchSection/index.js +9 -9
- package/v2Components/EmailMobilePreview/index.js +1 -1
- package/v2Components/ErrorInfoNote/index.js +13 -11
- package/v2Components/ErrorInfoNote/style.scss +1 -1
- package/v2Components/FormBuilder/_formBuilder.scss +1 -0
- package/v2Components/FormBuilder/index.js +32 -40
- package/v2Components/HtmlEditor/HTMLEditor.js +4 -4
- package/v2Components/HtmlEditor/_htmlEditor.scss +2 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/PreviewModeGroup.js +2 -2
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +2 -2
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +1 -0
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/SplitContainer.js +2 -2
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +2 -1
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +6 -9
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +2 -2
- package/v2Components/NavigationBar/index.js +7 -1
- package/v2Components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +3 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +5 -3
- package/v2Components/TemplatePreview/index.js +11 -9
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +3 -3
- package/v2Components/TestAndPreviewSlidebox/LeftPanelContent.js +5 -5
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +3 -3
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +4 -2
- package/v2Containers/BeePopupEditor/index.js +1 -1
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +5 -5
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +4 -3
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +3 -2
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +7 -7
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +0 -5
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +2 -2
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +2 -2
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -1
- package/v2Containers/CreativesContainer/index.js +1 -1
- package/v2Containers/Ebill/index.js +10 -9
- package/v2Containers/Email/index.js +7 -7
- package/v2Containers/Email/initialSchema.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Facebook/Advertisement/index.js +4 -4
- package/v2Containers/Facebook/index.js +2 -2
- package/v2Containers/InApp/index.js +21 -16
- package/v2Containers/InApp/index.scss +0 -7
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +2 -2
- package/v2Containers/InappAdvance/index.js +4 -4
- package/v2Containers/LanguageProvider/index.js +3 -3
- package/v2Containers/LanguageProvider/tests/index.test.js +3 -3
- package/v2Containers/Line/Container/Image/index.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/Content.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/index.js +5 -5
- package/v2Containers/Line/Container/ImageMap/index.js +3 -3
- package/v2Containers/Line/Container/Sticker/index.js +2 -2
- package/v2Containers/Line/Container/Sticker/utils.js +1 -1
- package/v2Containers/Line/Container/Video/index.js +1 -1
- package/v2Containers/Line/Container/Wrapper/index.js +3 -3
- package/v2Containers/Line/Container/Wrapper/style.js +1 -5
- package/v2Containers/Line/Container/index.js +2 -2
- package/v2Containers/Login/components/LoginForm/index.js +34 -47
- package/v2Containers/Login/index.js +5 -5
- package/v2Containers/MobilePushNew/components/CtaButtons.js +2 -2
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +9 -9
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +4 -4
- package/v2Containers/MobilePushNew/index.js +2 -2
- package/v2Containers/MobilePushNew/index.scss +6 -3
- package/v2Containers/Rcs/index.js +24 -19
- package/v2Containers/Rcs/index.scss +0 -7
- package/v2Containers/SmsTrai/Edit/index.js +3 -2
- package/v2Containers/Templates/index.js +16 -16
- package/v2Containers/Viber/constants.js +0 -8
- package/v2Containers/Viber/index.js +19 -19
- package/v2Containers/Viber/index.scss +0 -7
- package/v2Containers/Viber/reducer.js +21 -44
- package/v2Containers/Viber/sagas.js +21 -62
- package/v2Containers/Viber/tests/index.test.js +0 -80
- package/v2Containers/Viber/tests/saga.test.js +40 -365
- package/v2Containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +1 -1
- package/v2Containers/WebPush/Create/components/ButtonForm.js +2 -2
- package/v2Containers/WebPush/Create/components/ButtonList.js +4 -4
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +4 -4
- package/v2Containers/WebPush/Create/components/FormActions.js +3 -3
- package/v2Containers/WebPush/Create/components/MessageSection.js +2 -2
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +2 -2
- package/v2Containers/WebPush/Create/components/_buttons.scss +2 -2
- package/v2Containers/WebPush/Create/index.scss +6 -3
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +1 -1
- package/v2Containers/Whatsapp/index.js +28 -28
- package/v2Containers/Zalo/index.js +3 -3
- package/.npmrc copy +0 -2
- package/v2Containers/Viber/tests/reducer.test.js +0 -297
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { fromJS } from 'immutable';
|
|
2
|
-
import viberReducer from '../reducer';
|
|
3
|
-
import * as types from '../constants';
|
|
4
|
-
import { ASSET_STATUS } from '../../../utils/assetStatusConstants';
|
|
5
|
-
|
|
6
|
-
const initialState = fromJS({
|
|
7
|
-
uploadedAssetData: {},
|
|
8
|
-
createTemplateInProgress: false,
|
|
9
|
-
assetProcessing: {},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('viberReducer', () => {
|
|
13
|
-
it('returns initial state for unknown action', () => {
|
|
14
|
-
expect(viberReducer(undefined, { type: '@@INIT' })).toEqual(initialState);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('CREATE_VIBER_TEMPLATE_*', () => {
|
|
18
|
-
it('handles CREATE_VIBER_TEMPLATE_REQUEST', () => {
|
|
19
|
-
const next = viberReducer(initialState, {
|
|
20
|
-
type: types.CREATE_VIBER_TEMPLATE_REQUEST,
|
|
21
|
-
});
|
|
22
|
-
expect(next.get('createTemplateInProgress')).toBe(true);
|
|
23
|
-
expect(next.get('createTemplateError')).toBe(false);
|
|
24
|
-
expect(next.get('createTemplateErrorMessage')).toEqual(fromJS(''));
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('handles CREATE_VIBER_TEMPLATE_SUCCESS with status > 300', () => {
|
|
28
|
-
const next = viberReducer(initialState, {
|
|
29
|
-
type: types.CREATE_VIBER_TEMPLATE_SUCCESS,
|
|
30
|
-
data: { id: 'x' },
|
|
31
|
-
statusCode: 400,
|
|
32
|
-
errorMsg: 'oops',
|
|
33
|
-
});
|
|
34
|
-
expect(next.get('createTemplateInProgress')).toBe(false);
|
|
35
|
-
expect(next.get('response')).toEqual({ id: 'x' });
|
|
36
|
-
expect(next.get('createTemplateError')).toBe(true);
|
|
37
|
-
expect(next.get('createTemplateErrorMessage')).toEqual(fromJS('oops'));
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('handles CREATE_VIBER_TEMPLATE_SUCCESS with status <= 300', () => {
|
|
41
|
-
const next = viberReducer(initialState, {
|
|
42
|
-
type: types.CREATE_VIBER_TEMPLATE_SUCCESS,
|
|
43
|
-
data: { id: 'x' },
|
|
44
|
-
statusCode: 200,
|
|
45
|
-
errorMsg: '',
|
|
46
|
-
});
|
|
47
|
-
expect(next.get('createTemplateError')).toBe(false);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('handles CREATE_VIBER_TEMPLATE_FAILURE', () => {
|
|
51
|
-
const next = viberReducer(initialState, {
|
|
52
|
-
type: types.CREATE_VIBER_TEMPLATE_FAILURE,
|
|
53
|
-
errorMsg: 'bad',
|
|
54
|
-
});
|
|
55
|
-
expect(next.get('createTemplateInProgress')).toBe(false);
|
|
56
|
-
expect(next.get('createTemplateError')).toBe(true);
|
|
57
|
-
expect(next.get('createTemplateErrorMessage')).toEqual(fromJS('bad'));
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('UPLOAD_VIBER_ASSET_*', () => {
|
|
62
|
-
it('handles UPLOAD_VIBER_ASSET_REQUEST', () => {
|
|
63
|
-
const next = viberReducer(initialState, {
|
|
64
|
-
type: types.UPLOAD_VIBER_ASSET_REQUEST,
|
|
65
|
-
});
|
|
66
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
67
|
-
expect(next.get('assetUploading')).toBe(true);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('handles UPLOAD_VIBER_ASSET_SUCCESS and wraps data with fromJS (finding 2)', () => {
|
|
71
|
-
const payload = { url: 'https://cdn/x.png', meta: { size: 100 } };
|
|
72
|
-
const next = viberReducer(initialState, {
|
|
73
|
-
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
74
|
-
data: payload,
|
|
75
|
-
statusCode: 200,
|
|
76
|
-
});
|
|
77
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
78
|
-
expect(next.get('uploadAssetSuccess')).toBe(true);
|
|
79
|
-
// must be wrapped in Immutable (same as asyncUploadCases.handleCompleted)
|
|
80
|
-
const stored = next.get('uploadedAssetData');
|
|
81
|
-
expect(stored).toEqual(fromJS(payload));
|
|
82
|
-
// verify it's actually an Immutable Map, not a plain JS object
|
|
83
|
-
expect(stored.toJS).toBeDefined();
|
|
84
|
-
expect(typeof stored.toJS).toBe('function');
|
|
85
|
-
expect(stored.get('url')).toBe(payload.url);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('handles UPLOAD_VIBER_ASSET_SUCCESS with templateType key wrapped in fromJS', () => {
|
|
89
|
-
const payload = { url: 'https://cdn/y.mp4' };
|
|
90
|
-
const next = viberReducer(initialState, {
|
|
91
|
-
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
92
|
-
data: payload,
|
|
93
|
-
statusCode: 200,
|
|
94
|
-
templateType: 3,
|
|
95
|
-
});
|
|
96
|
-
const stored = next.get('uploadedAssetData3');
|
|
97
|
-
expect(stored).toEqual(fromJS(payload));
|
|
98
|
-
expect(stored.get('url')).toBe(payload.url);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('UPLOAD_VIBER_ASSET_SUCCESS sets uploadAssetSuccess false when status >= 300', () => {
|
|
102
|
-
const next = viberReducer(initialState, {
|
|
103
|
-
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
104
|
-
data: {},
|
|
105
|
-
statusCode: 500,
|
|
106
|
-
});
|
|
107
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('UPLOAD_VIBER_ASSET_SUCCESS sync and async produce same shape', () => {
|
|
111
|
-
const asset = { url: 'https://cdn/same.png' };
|
|
112
|
-
const sync = viberReducer(initialState, {
|
|
113
|
-
type: types.UPLOAD_VIBER_ASSET_SUCCESS,
|
|
114
|
-
data: asset,
|
|
115
|
-
statusCode: 200,
|
|
116
|
-
});
|
|
117
|
-
const async_ = viberReducer(initialState, {
|
|
118
|
-
type: types.UPLOAD_VIBER_ASSET_COMPLETED,
|
|
119
|
-
payload: { assetId: 'a1', asset },
|
|
120
|
-
});
|
|
121
|
-
// Both paths should store uploadedAssetData as Immutable fromJS(asset)
|
|
122
|
-
expect(sync.get('uploadedAssetData')).toEqual(async_.get('uploadedAssetData'));
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('handles UPLOAD_VIBER_ASSET_FAILURE', () => {
|
|
126
|
-
const next = viberReducer(initialState, {
|
|
127
|
-
type: types.UPLOAD_VIBER_ASSET_FAILURE,
|
|
128
|
-
});
|
|
129
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
130
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe('async polling cases', () => {
|
|
135
|
-
it('handles UPLOAD_VIBER_ASSET_PROCESSING', () => {
|
|
136
|
-
const next = viberReducer(initialState, {
|
|
137
|
-
type: types.UPLOAD_VIBER_ASSET_PROCESSING,
|
|
138
|
-
payload: { assetId: 'a1', asset: { id: 'a1' } },
|
|
139
|
-
});
|
|
140
|
-
expect(next.get('assetUploading')).toBe(true);
|
|
141
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
142
|
-
expect(next.getIn(['assetProcessing', 'a1', 'status'])).toBe(ASSET_STATUS.PROCESSING);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('handles UPLOAD_VIBER_ASSET_COMPLETED', () => {
|
|
146
|
-
const next = viberReducer(initialState, {
|
|
147
|
-
type: types.UPLOAD_VIBER_ASSET_COMPLETED,
|
|
148
|
-
payload: { assetId: 'a1', asset: { url: 'https://cdn/x.png' } },
|
|
149
|
-
});
|
|
150
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
151
|
-
expect(next.get('uploadAssetSuccess')).toBe(true);
|
|
152
|
-
expect(next.getIn(['assetProcessing', 'a1', 'status'])).toBe(ASSET_STATUS.COMPLETED);
|
|
153
|
-
expect(next.get('uploadedAssetData')).toEqual(fromJS({ url: 'https://cdn/x.png' }));
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('handles UPLOAD_VIBER_ASSET_FAILED', () => {
|
|
157
|
-
const next = viberReducer(initialState, {
|
|
158
|
-
type: types.UPLOAD_VIBER_ASSET_FAILED,
|
|
159
|
-
payload: { assetId: 'a1', error: 'boom' },
|
|
160
|
-
});
|
|
161
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
162
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
163
|
-
expect(next.getIn(['assetProcessing', 'a1', 'status'])).toBe(ASSET_STATUS.FAILED);
|
|
164
|
-
expect(next.getIn(['assetProcessing', 'a1', 'error'])).toBe('boom');
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('handles UPLOAD_VIBER_ASSET_TIMEOUT', () => {
|
|
168
|
-
const next = viberReducer(initialState, {
|
|
169
|
-
type: types.UPLOAD_VIBER_ASSET_TIMEOUT,
|
|
170
|
-
payload: { assetId: 'a1', message: 'timed out' },
|
|
171
|
-
});
|
|
172
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
173
|
-
expect(next.getIn(['assetProcessing', 'a1', 'status'])).toBe(ASSET_STATUS.TIMEOUT);
|
|
174
|
-
expect(next.getIn(['assetProcessing', 'a1', 'error'])).toBe('timed out');
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
describe('CLEAR_VIBER_ASSET (finding 3)', () => {
|
|
179
|
-
const dirtyState = initialState
|
|
180
|
-
.set('assetUploading', true)
|
|
181
|
-
.set('uploadAssetSuccess', true)
|
|
182
|
-
.set('uploadedAssetData', fromJS({ url: 'x' }))
|
|
183
|
-
.set('uploadedAssetData2', fromJS({ url: 'y' }))
|
|
184
|
-
.setIn(['assetProcessing', 'a1'], fromJS({ status: 'processing' }));
|
|
185
|
-
|
|
186
|
-
it('clears default uploadedAssetData and resets upload flags', () => {
|
|
187
|
-
const next = viberReducer(dirtyState, { type: types.CLEAR_VIBER_ASSET });
|
|
188
|
-
expect(next.has('uploadedAssetData')).toBe(false);
|
|
189
|
-
expect(next.get('assetProcessing')).toEqual(fromJS({}));
|
|
190
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
191
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('clears templateType-specific uploadedAssetData and resets upload flags', () => {
|
|
195
|
-
const next = viberReducer(dirtyState, {
|
|
196
|
-
type: types.CLEAR_VIBER_ASSET,
|
|
197
|
-
templateType: 2,
|
|
198
|
-
});
|
|
199
|
-
expect(next.has('uploadedAssetData2')).toBe(false);
|
|
200
|
-
// default key untouched by specific clear
|
|
201
|
-
expect(next.has('uploadedAssetData')).toBe(true);
|
|
202
|
-
expect(next.get('assetProcessing')).toEqual(fromJS({}));
|
|
203
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
204
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
describe('CLEAR_VIBER_DATA (finding 3 mirror)', () => {
|
|
209
|
-
it('clears assetProcessing, assetUploading, uploadAssetSuccess', () => {
|
|
210
|
-
const dirtyState = initialState
|
|
211
|
-
.set('assetUploading', true)
|
|
212
|
-
.set('uploadAssetSuccess', true)
|
|
213
|
-
.set('metaEntities', fromJS({ some: 'data' }))
|
|
214
|
-
.set('templateDetails', fromJS({ id: 'x' }))
|
|
215
|
-
.setIn(['assetProcessing', 'a1'], fromJS({ status: 'processing' }));
|
|
216
|
-
const next = viberReducer(dirtyState, { type: types.CLEAR_VIBER_DATA });
|
|
217
|
-
expect(next.has('uploadedAssetData')).toBe(false);
|
|
218
|
-
expect(next.has('metaEntities')).toBe(false);
|
|
219
|
-
expect(next.has('templateDetails')).toBe(false);
|
|
220
|
-
expect(next.get('assetProcessing')).toEqual(fromJS({}));
|
|
221
|
-
expect(next.get('assetUploading')).toBe(false);
|
|
222
|
-
expect(next.get('uploadAssetSuccess')).toBe(false);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe('EDIT_VIBER_TEMPLATE_*', () => {
|
|
227
|
-
it('handles EDIT_VIBER_TEMPLATE_REQUEST', () => {
|
|
228
|
-
const next = viberReducer(initialState, {
|
|
229
|
-
type: types.EDIT_VIBER_TEMPLATE_REQUEST,
|
|
230
|
-
});
|
|
231
|
-
expect(next.get('editTemplateInProgress')).toBe(true);
|
|
232
|
-
expect(next.get('editTemplateError')).toBe(false);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('handles EDIT_VIBER_TEMPLATE_SUCCESS', () => {
|
|
236
|
-
const next = viberReducer(initialState, {
|
|
237
|
-
type: types.EDIT_VIBER_TEMPLATE_SUCCESS,
|
|
238
|
-
data: { id: 'e' },
|
|
239
|
-
statusCode: 200,
|
|
240
|
-
errorMsg: '',
|
|
241
|
-
});
|
|
242
|
-
expect(next.get('editTemplateInProgress')).toBe(false);
|
|
243
|
-
expect(next.get('editResponse')).toEqual({ id: 'e' });
|
|
244
|
-
expect(next.get('editTemplateError')).toBe(false);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it('handles EDIT_VIBER_TEMPLATE_SUCCESS error status', () => {
|
|
248
|
-
const next = viberReducer(initialState, {
|
|
249
|
-
type: types.EDIT_VIBER_TEMPLATE_SUCCESS,
|
|
250
|
-
data: {},
|
|
251
|
-
statusCode: 500,
|
|
252
|
-
errorMsg: 'err',
|
|
253
|
-
});
|
|
254
|
-
expect(next.get('editTemplateError')).toBe(true);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it('handles EDIT_VIBER_TEMPLATE_FAILURE', () => {
|
|
258
|
-
const next = viberReducer(initialState, {
|
|
259
|
-
type: types.EDIT_VIBER_TEMPLATE_FAILURE,
|
|
260
|
-
errorMsg: 'nope',
|
|
261
|
-
});
|
|
262
|
-
expect(next.get('editTemplateError')).toBe(true);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
describe('GET/CLEAR branches', () => {
|
|
267
|
-
it('handles GET_VIBER_TEMPLATE_DETAILS_REQUEST', () => {
|
|
268
|
-
const next = viberReducer(initialState, {
|
|
269
|
-
type: types.GET_VIBER_TEMPLATE_DETAILS_REQUEST,
|
|
270
|
-
});
|
|
271
|
-
expect(next.get('getTemplateDetailsInProgress')).toBe(true);
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
it('handles GET_VIBER_TEMPLATE_DETAILS_SUCCESS', () => {
|
|
275
|
-
const next = viberReducer(initialState, {
|
|
276
|
-
type: types.GET_VIBER_TEMPLATE_DETAILS_SUCCESS,
|
|
277
|
-
data: { id: 'd' },
|
|
278
|
-
});
|
|
279
|
-
expect(next.get('getTemplateDetailsInProgress')).toBe(false);
|
|
280
|
-
expect(next.get('templateDetails')).toEqual({ id: 'd' });
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it('handles GET_VIBER_TEMPLATE_DETAILS_FAILURE / CLEAR_VIBER_EDIT_RESPONSE_REQUEST', () => {
|
|
284
|
-
const next = viberReducer(initialState, {
|
|
285
|
-
type: types.CLEAR_VIBER_EDIT_RESPONSE_REQUEST,
|
|
286
|
-
});
|
|
287
|
-
expect(next.get('editResponse')).toEqual({});
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
it('handles CLEAR_VIBER_CREATE_RESPONSE_REQUEST', () => {
|
|
291
|
-
const next = viberReducer(initialState, {
|
|
292
|
-
type: types.CLEAR_VIBER_CREATE_RESPONSE_REQUEST,
|
|
293
|
-
});
|
|
294
|
-
expect(next.get('response')).toEqual({});
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
});
|