@atlaskit/media-test-helpers 31.0.0 → 32.1.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/CHANGELOG.md +21 -0
- package/dist/cjs/authProvider.js +25 -27
- package/dist/cjs/await-error.js +17 -19
- package/dist/cjs/docs-content-tabs.js +1 -0
- package/dist/cjs/fakeMediaClient.js +0 -5
- package/dist/cjs/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
- package/dist/cjs/fileStateFactory/{factory.js → factory/factory.js} +34 -25
- package/dist/cjs/fileStateFactory/factory/index.js +38 -0
- package/dist/cjs/fileStateFactory/fileSimulation/fileSimulation.js +89 -0
- package/dist/cjs/fileStateFactory/fileSimulation/index.js +79 -0
- package/dist/cjs/fileStateFactory/fileSimulation/simulations.js +399 -0
- package/dist/cjs/fileStateFactory/index.js +76 -4
- package/dist/cjs/getAuthFromContextProvider.js +21 -23
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/mediaPickerAuthProvider.js +22 -24
- package/dist/cjs/mocks/database/collection-item.js +5 -0
- package/dist/cjs/mocks/database/index.js +6 -0
- package/dist/cjs/mocks/routers/api-router.js +92 -98
- package/dist/cjs/story-list.js +1 -1
- package/dist/cjs/utils/logging.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/waitUntil.js +19 -21
- package/dist/es2019/fakeMediaClient.js +0 -5
- package/dist/es2019/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -17
- package/dist/es2019/fileStateFactory/{factory.js → factory/factory.js} +12 -2
- package/dist/es2019/fileStateFactory/factory/index.js +3 -0
- package/dist/es2019/fileStateFactory/fileSimulation/fileSimulation.js +63 -0
- package/dist/es2019/fileStateFactory/fileSimulation/index.js +2 -0
- package/dist/es2019/fileStateFactory/fileSimulation/simulations.js +148 -0
- package/dist/es2019/fileStateFactory/index.js +4 -2
- package/dist/es2019/index.js +5 -1
- package/dist/es2019/mocks/database/collection-item.js +1 -0
- package/dist/es2019/mocks/database/index.js +1 -1
- package/dist/es2019/mocks/routers/api-router.js +3 -3
- package/dist/es2019/utils/logging.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/authProvider.js +25 -27
- package/dist/esm/await-error.js +17 -19
- package/dist/esm/fakeMediaClient.js +0 -5
- package/dist/esm/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
- package/dist/esm/fileStateFactory/{factory.js → factory/factory.js} +34 -25
- package/dist/esm/fileStateFactory/factory/index.js +3 -0
- package/dist/esm/fileStateFactory/fileSimulation/fileSimulation.js +81 -0
- package/dist/esm/fileStateFactory/fileSimulation/index.js +2 -0
- package/dist/esm/fileStateFactory/fileSimulation/simulations.js +382 -0
- package/dist/esm/fileStateFactory/index.js +4 -2
- package/dist/esm/getAuthFromContextProvider.js +21 -23
- package/dist/esm/index.js +5 -1
- package/dist/esm/mediaPickerAuthProvider.js +22 -24
- package/dist/esm/mocks/database/collection-item.js +3 -0
- package/dist/esm/mocks/database/index.js +1 -1
- package/dist/esm/mocks/routers/api-router.js +93 -99
- package/dist/esm/utils/logging.js +3 -3
- package/dist/esm/version.json +1 -1
- package/dist/esm/waitUntil.js +19 -21
- package/dist/types/fileStateFactory/{factory.d.ts → factory/factory.d.ts} +3 -0
- package/dist/types/fileStateFactory/factory/index.d.ts +4 -0
- package/dist/types/fileStateFactory/fileSimulation/fileSimulation.d.ts +18 -0
- package/dist/types/fileStateFactory/fileSimulation/index.d.ts +4 -0
- package/dist/types/fileStateFactory/fileSimulation/simulations.d.ts +35 -0
- package/dist/types/fileStateFactory/index.d.ts +7 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/mocks/database/collection-item.d.ts +13 -1
- package/dist/types/mocks/database/collection.d.ts +4 -1
- package/dist/types/mocks/database/index.d.ts +2 -2
- package/package.json +4 -3
- package/report.api.md +90 -0
- /package/dist/cjs/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/es2019/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/esm/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/types/fileStateFactory/{createFileState.d.ts → factory/createFileState.d.ts} +0 -0
- /package/dist/types/fileStateFactory/{helpers.d.ts → factory/helpers.d.ts} +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.simulateUpload = exports.simulateUpdateFileId = exports.simulateProcessing = exports.simulateProcessed = exports.simulateManyProcessed = exports.simulateImmediateFailProcessing = exports.simulateErrorState = exports.simulateError = exports.simulateEmptyDetails = exports.simulateAlwaysProcessing = exports.simulateAlwaysLoading = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _nextTick = require("../../nextTick");
|
|
11
|
+
var speed = 1500;
|
|
12
|
+
/**
|
|
13
|
+
* Normal File Flow
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var simulateProcessed = function simulateProcessed() {
|
|
17
|
+
var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
18
|
+
return {
|
|
19
|
+
simulation: function () {
|
|
20
|
+
var _simulation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(factory) {
|
|
21
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
_context.next = 2;
|
|
25
|
+
return (0, _nextTick.sleep)(speed);
|
|
26
|
+
case 2:
|
|
27
|
+
factory.next('processed', {
|
|
28
|
+
withRemotePreview: withRemotePreview
|
|
29
|
+
});
|
|
30
|
+
case 3:
|
|
31
|
+
case "end":
|
|
32
|
+
return _context.stop();
|
|
33
|
+
}
|
|
34
|
+
}, _callee);
|
|
35
|
+
}));
|
|
36
|
+
function simulation(_x) {
|
|
37
|
+
return _simulation.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
return simulation;
|
|
40
|
+
}(),
|
|
41
|
+
description: "File state is processed ".concat(withRemotePreview ? 'with' : 'without', " remote preview")
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.simulateProcessed = simulateProcessed;
|
|
45
|
+
var simulateProcessing = function simulateProcessing() {
|
|
46
|
+
var suceeded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
47
|
+
var withRemotePreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
48
|
+
return {
|
|
49
|
+
description: "File is processing, then ".concat(suceeded ? 'succeeds' : 'fails', " ").concat(withRemotePreview ? 'with' : 'without', " remote preview"),
|
|
50
|
+
simulation: function () {
|
|
51
|
+
var _simulation2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(factory) {
|
|
52
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
_context2.next = 2;
|
|
56
|
+
return (0, _nextTick.sleep)(speed);
|
|
57
|
+
case 2:
|
|
58
|
+
factory.next('processing');
|
|
59
|
+
_context2.next = 5;
|
|
60
|
+
return (0, _nextTick.sleep)(speed);
|
|
61
|
+
case 5:
|
|
62
|
+
factory.next('processing');
|
|
63
|
+
_context2.next = 8;
|
|
64
|
+
return (0, _nextTick.sleep)(speed * 0.5);
|
|
65
|
+
case 8:
|
|
66
|
+
if (!suceeded) {
|
|
67
|
+
factory.next('failed-processing', {
|
|
68
|
+
withRemotePreview: withRemotePreview
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
factory.next('processed', {
|
|
72
|
+
withRemotePreview: withRemotePreview
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
case 9:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
function simulation(_x2) {
|
|
82
|
+
return _simulation2.apply(this, arguments);
|
|
83
|
+
}
|
|
84
|
+
return simulation;
|
|
85
|
+
}()
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
exports.simulateProcessing = simulateProcessing;
|
|
89
|
+
var simulateImmediateFailProcessing = function simulateImmediateFailProcessing() {
|
|
90
|
+
return {
|
|
91
|
+
description: 'The first sate is failed-processing with no preview',
|
|
92
|
+
simulation: function () {
|
|
93
|
+
var _simulation3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(factory) {
|
|
94
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
95
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
_context3.next = 2;
|
|
98
|
+
return (0, _nextTick.sleep)(speed);
|
|
99
|
+
case 2:
|
|
100
|
+
factory.next('failed-processing');
|
|
101
|
+
case 3:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context3.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee3);
|
|
106
|
+
}));
|
|
107
|
+
function simulation(_x3) {
|
|
108
|
+
return _simulation3.apply(this, arguments);
|
|
109
|
+
}
|
|
110
|
+
return simulation;
|
|
111
|
+
}()
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
exports.simulateImmediateFailProcessing = simulateImmediateFailProcessing;
|
|
115
|
+
var simulateUpload = function simulateUpload(withLocalPreview) {
|
|
116
|
+
var suceeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
117
|
+
return {
|
|
118
|
+
description: '',
|
|
119
|
+
simulation: function () {
|
|
120
|
+
var _simulation4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(factory) {
|
|
121
|
+
var chunks, chunkUploadDelay, processingTime, uploadUpTo, index;
|
|
122
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
123
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
chunks = 3;
|
|
126
|
+
chunkUploadDelay = 500;
|
|
127
|
+
processingTime = speed;
|
|
128
|
+
_context4.next = 5;
|
|
129
|
+
return (0, _nextTick.sleep)(speed);
|
|
130
|
+
case 5:
|
|
131
|
+
factory.next('uploading', {
|
|
132
|
+
withLocalPreview: withLocalPreview
|
|
133
|
+
});
|
|
134
|
+
uploadUpTo = !suceeded ? chunks / 2 : chunks;
|
|
135
|
+
index = 0;
|
|
136
|
+
case 8:
|
|
137
|
+
if (!(index <= uploadUpTo)) {
|
|
138
|
+
_context4.next = 15;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
factory.next('uploading', {
|
|
142
|
+
uploadProgress: index / chunks,
|
|
143
|
+
withLocalPreview: withLocalPreview
|
|
144
|
+
});
|
|
145
|
+
_context4.next = 12;
|
|
146
|
+
return (0, _nextTick.sleep)(chunkUploadDelay);
|
|
147
|
+
case 12:
|
|
148
|
+
index++;
|
|
149
|
+
_context4.next = 8;
|
|
150
|
+
break;
|
|
151
|
+
case 15:
|
|
152
|
+
if (!suceeded) {
|
|
153
|
+
factory.error(new Error('some-error'));
|
|
154
|
+
}
|
|
155
|
+
factory.next('processing', {
|
|
156
|
+
withLocalPreview: withLocalPreview
|
|
157
|
+
});
|
|
158
|
+
_context4.next = 19;
|
|
159
|
+
return (0, _nextTick.sleep)(processingTime);
|
|
160
|
+
case 19:
|
|
161
|
+
factory.next('processed', {
|
|
162
|
+
withLocalPreview: withLocalPreview
|
|
163
|
+
});
|
|
164
|
+
case 20:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context4.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee4);
|
|
169
|
+
}));
|
|
170
|
+
function simulation(_x4) {
|
|
171
|
+
return _simulation4.apply(this, arguments);
|
|
172
|
+
}
|
|
173
|
+
return simulation;
|
|
174
|
+
}()
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
exports.simulateUpload = simulateUpload;
|
|
178
|
+
var simulateErrorState = function simulateErrorState() {
|
|
179
|
+
return {
|
|
180
|
+
description: 'File state is error',
|
|
181
|
+
simulation: function () {
|
|
182
|
+
var _simulation5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(factory) {
|
|
183
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
184
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
185
|
+
case 0:
|
|
186
|
+
_context5.next = 2;
|
|
187
|
+
return (0, _nextTick.sleep)(speed);
|
|
188
|
+
case 2:
|
|
189
|
+
factory.next('error');
|
|
190
|
+
case 3:
|
|
191
|
+
case "end":
|
|
192
|
+
return _context5.stop();
|
|
193
|
+
}
|
|
194
|
+
}, _callee5);
|
|
195
|
+
}));
|
|
196
|
+
function simulation(_x5) {
|
|
197
|
+
return _simulation5.apply(this, arguments);
|
|
198
|
+
}
|
|
199
|
+
return simulation;
|
|
200
|
+
}()
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
exports.simulateErrorState = simulateErrorState;
|
|
204
|
+
var simulateError = function simulateError() {
|
|
205
|
+
return {
|
|
206
|
+
description: 'Subscription throws an error through the observer',
|
|
207
|
+
simulation: function () {
|
|
208
|
+
var _simulation6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(factory) {
|
|
209
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
210
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
211
|
+
case 0:
|
|
212
|
+
_context6.next = 2;
|
|
213
|
+
return (0, _nextTick.sleep)(speed);
|
|
214
|
+
case 2:
|
|
215
|
+
factory.error(new Error('error thrown from client'));
|
|
216
|
+
case 3:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context6.stop();
|
|
219
|
+
}
|
|
220
|
+
}, _callee6);
|
|
221
|
+
}));
|
|
222
|
+
function simulation(_x6) {
|
|
223
|
+
return _simulation6.apply(this, arguments);
|
|
224
|
+
}
|
|
225
|
+
return simulation;
|
|
226
|
+
}()
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Rare Cases
|
|
232
|
+
*/
|
|
233
|
+
exports.simulateError = simulateError;
|
|
234
|
+
var simulateManyProcessed = function simulateManyProcessed() {
|
|
235
|
+
var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
236
|
+
return {
|
|
237
|
+
description: '',
|
|
238
|
+
simulation: function () {
|
|
239
|
+
var _simulation7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(factory) {
|
|
240
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
241
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
_context7.next = 2;
|
|
244
|
+
return (0, _nextTick.sleep)(speed);
|
|
245
|
+
case 2:
|
|
246
|
+
factory.next('processed', {
|
|
247
|
+
withRemotePreview: withRemotePreview
|
|
248
|
+
});
|
|
249
|
+
_context7.next = 5;
|
|
250
|
+
return (0, _nextTick.sleep)(speed);
|
|
251
|
+
case 5:
|
|
252
|
+
factory.next('processed', {
|
|
253
|
+
withRemotePreview: withRemotePreview
|
|
254
|
+
});
|
|
255
|
+
_context7.next = 8;
|
|
256
|
+
return (0, _nextTick.sleep)(speed);
|
|
257
|
+
case 8:
|
|
258
|
+
factory.next('processed', {
|
|
259
|
+
withRemotePreview: withRemotePreview
|
|
260
|
+
});
|
|
261
|
+
case 9:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context7.stop();
|
|
264
|
+
}
|
|
265
|
+
}, _callee7);
|
|
266
|
+
}));
|
|
267
|
+
function simulation(_x7) {
|
|
268
|
+
return _simulation7.apply(this, arguments);
|
|
269
|
+
}
|
|
270
|
+
return simulation;
|
|
271
|
+
}()
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
exports.simulateManyProcessed = simulateManyProcessed;
|
|
275
|
+
var simulateEmptyDetails = function simulateEmptyDetails() {
|
|
276
|
+
return {
|
|
277
|
+
description: 'Incomplete uploads return empty file details and a processing status pending',
|
|
278
|
+
simulation: function () {
|
|
279
|
+
var _simulation8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(factory) {
|
|
280
|
+
var emptyDetails;
|
|
281
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
282
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
283
|
+
case 0:
|
|
284
|
+
emptyDetails = {
|
|
285
|
+
createdAt: 1630986510989
|
|
286
|
+
};
|
|
287
|
+
_context8.next = 3;
|
|
288
|
+
return (0, _nextTick.sleep)(speed);
|
|
289
|
+
case 3:
|
|
290
|
+
factory.next('processing', {
|
|
291
|
+
fileDetails: emptyDetails
|
|
292
|
+
});
|
|
293
|
+
case 4:
|
|
294
|
+
case "end":
|
|
295
|
+
return _context8.stop();
|
|
296
|
+
}
|
|
297
|
+
}, _callee8);
|
|
298
|
+
}));
|
|
299
|
+
function simulation(_x8) {
|
|
300
|
+
return _simulation8.apply(this, arguments);
|
|
301
|
+
}
|
|
302
|
+
return simulation;
|
|
303
|
+
}()
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
exports.simulateEmptyDetails = simulateEmptyDetails;
|
|
307
|
+
var simulateUpdateFileId = function simulateUpdateFileId() {
|
|
308
|
+
return {
|
|
309
|
+
description: 'First File Id: video with processing issue. Next File Id: PDF sucessfully processed',
|
|
310
|
+
simulation: function () {
|
|
311
|
+
var _simulation9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(factory, _ref) {
|
|
312
|
+
var updateIdentifier;
|
|
313
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
314
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
315
|
+
case 0:
|
|
316
|
+
updateIdentifier = _ref.updateIdentifier;
|
|
317
|
+
_context9.next = 3;
|
|
318
|
+
return (0, _nextTick.sleep)(speed);
|
|
319
|
+
case 3:
|
|
320
|
+
factory.next('failed-processing');
|
|
321
|
+
_context9.next = 6;
|
|
322
|
+
return (0, _nextTick.sleep)(speed);
|
|
323
|
+
case 6:
|
|
324
|
+
updateIdentifier('doc');
|
|
325
|
+
_context9.next = 9;
|
|
326
|
+
return (0, _nextTick.sleep)(speed);
|
|
327
|
+
case 9:
|
|
328
|
+
factory.next('processing');
|
|
329
|
+
_context9.next = 12;
|
|
330
|
+
return (0, _nextTick.sleep)(speed);
|
|
331
|
+
case 12:
|
|
332
|
+
factory.next('processed');
|
|
333
|
+
case 13:
|
|
334
|
+
case "end":
|
|
335
|
+
return _context9.stop();
|
|
336
|
+
}
|
|
337
|
+
}, _callee9);
|
|
338
|
+
}));
|
|
339
|
+
function simulation(_x9, _x10) {
|
|
340
|
+
return _simulation9.apply(this, arguments);
|
|
341
|
+
}
|
|
342
|
+
return simulation;
|
|
343
|
+
}()
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
exports.simulateUpdateFileId = simulateUpdateFileId;
|
|
347
|
+
var simulateAlwaysLoading = function simulateAlwaysLoading() {
|
|
348
|
+
return {
|
|
349
|
+
description: 'File state never fetched',
|
|
350
|
+
simulation: function () {
|
|
351
|
+
var _simulation10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
352
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
353
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
354
|
+
case 0:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context10.stop();
|
|
357
|
+
}
|
|
358
|
+
}, _callee10);
|
|
359
|
+
}));
|
|
360
|
+
function simulation() {
|
|
361
|
+
return _simulation10.apply(this, arguments);
|
|
362
|
+
}
|
|
363
|
+
return simulation;
|
|
364
|
+
}()
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
exports.simulateAlwaysLoading = simulateAlwaysLoading;
|
|
368
|
+
var simulateAlwaysProcessing = function simulateAlwaysProcessing() {
|
|
369
|
+
return {
|
|
370
|
+
description: 'File state is permanently processing',
|
|
371
|
+
simulation: function () {
|
|
372
|
+
var _simulation11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(factory) {
|
|
373
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
374
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
375
|
+
case 0:
|
|
376
|
+
_context11.next = 2;
|
|
377
|
+
return (0, _nextTick.sleep)(speed);
|
|
378
|
+
case 2:
|
|
379
|
+
factory.next('processing');
|
|
380
|
+
_context11.next = 5;
|
|
381
|
+
return (0, _nextTick.sleep)(speed);
|
|
382
|
+
case 5:
|
|
383
|
+
factory.next('processing');
|
|
384
|
+
_context11.next = 8;
|
|
385
|
+
return (0, _nextTick.sleep)(speed * 0.5);
|
|
386
|
+
case 8:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context11.stop();
|
|
389
|
+
}
|
|
390
|
+
}, _callee11);
|
|
391
|
+
}));
|
|
392
|
+
function simulation(_x11) {
|
|
393
|
+
return _simulation11.apply(this, arguments);
|
|
394
|
+
}
|
|
395
|
+
return simulation;
|
|
396
|
+
}()
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
exports.simulateAlwaysProcessing = simulateAlwaysProcessing;
|
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "MediaClientMock", {
|
|
|
18
18
|
Object.defineProperty(exports, "createFileDetails", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _factory.createFileDetails;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "createFileState", {
|
|
@@ -30,9 +30,81 @@ Object.defineProperty(exports, "createFileState", {
|
|
|
30
30
|
Object.defineProperty(exports, "createIdentifier", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return
|
|
33
|
+
return _factory.createIdentifier;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "simulateAlwaysLoading", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _fileSimulation.simulateAlwaysLoading;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "simulateAlwaysProcessing", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _fileSimulation.simulateAlwaysProcessing;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "simulateEmptyDetails", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _fileSimulation.simulateEmptyDetails;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "simulateError", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _fileSimulation.simulateError;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "simulateErrorState", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _fileSimulation.simulateErrorState;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "simulateImmediateFailProcessing", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _fileSimulation.simulateImmediateFailProcessing;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "simulateManyProcessed", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _fileSimulation.simulateManyProcessed;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "simulateProcessed", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _fileSimulation.simulateProcessed;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "simulateProcessing", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _fileSimulation.simulateProcessing;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "simulateUpdateFileId", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _fileSimulation.simulateUpdateFileId;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "simulateUpload", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _fileSimulation.simulateUpload;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "useRunSimulation", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _fileSimulation.useRunSimulation;
|
|
34
106
|
}
|
|
35
107
|
});
|
|
36
108
|
var _factory = require("./factory");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
109
|
+
var _createFileState = require("./factory/createFileState");
|
|
110
|
+
var _fileSimulation = require("./fileSimulation");
|
|
@@ -21,29 +21,27 @@ var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
21
21
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
22
22
|
var url, body, headers, response;
|
|
23
23
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
24
|
-
while (1) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return _context.stop();
|
|
46
|
-
}
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
|
|
27
|
+
body = JSON.stringify({
|
|
28
|
+
access: access
|
|
29
|
+
});
|
|
30
|
+
headers = new Headers();
|
|
31
|
+
headers.append('Content-Type', 'application/json; charset=utf-8');
|
|
32
|
+
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
33
|
+
_context.next = 7;
|
|
34
|
+
return fetch(url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: body,
|
|
37
|
+
headers: headers
|
|
38
|
+
});
|
|
39
|
+
case 7:
|
|
40
|
+
response = _context.sent;
|
|
41
|
+
return _context.abrupt("return", response.json());
|
|
42
|
+
case 9:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
47
45
|
}
|
|
48
46
|
}, _callee);
|
|
49
47
|
}));
|
package/dist/cjs/index.js
CHANGED
|
@@ -611,6 +611,72 @@ Object.defineProperty(exports, "shallowWithIntlContext", {
|
|
|
611
611
|
return _mountWithIntlContext.shallowWithIntlContext;
|
|
612
612
|
}
|
|
613
613
|
});
|
|
614
|
+
Object.defineProperty(exports, "simulateAlwaysLoading", {
|
|
615
|
+
enumerable: true,
|
|
616
|
+
get: function get() {
|
|
617
|
+
return _fileStateFactory.simulateAlwaysLoading;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
Object.defineProperty(exports, "simulateAlwaysProcessing", {
|
|
621
|
+
enumerable: true,
|
|
622
|
+
get: function get() {
|
|
623
|
+
return _fileStateFactory.simulateAlwaysProcessing;
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
Object.defineProperty(exports, "simulateEmptyDetails", {
|
|
627
|
+
enumerable: true,
|
|
628
|
+
get: function get() {
|
|
629
|
+
return _fileStateFactory.simulateEmptyDetails;
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
Object.defineProperty(exports, "simulateError", {
|
|
633
|
+
enumerable: true,
|
|
634
|
+
get: function get() {
|
|
635
|
+
return _fileStateFactory.simulateError;
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
Object.defineProperty(exports, "simulateErrorState", {
|
|
639
|
+
enumerable: true,
|
|
640
|
+
get: function get() {
|
|
641
|
+
return _fileStateFactory.simulateErrorState;
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
Object.defineProperty(exports, "simulateImmediateFailProcessing", {
|
|
645
|
+
enumerable: true,
|
|
646
|
+
get: function get() {
|
|
647
|
+
return _fileStateFactory.simulateImmediateFailProcessing;
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
Object.defineProperty(exports, "simulateManyProcessed", {
|
|
651
|
+
enumerable: true,
|
|
652
|
+
get: function get() {
|
|
653
|
+
return _fileStateFactory.simulateManyProcessed;
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
Object.defineProperty(exports, "simulateProcessed", {
|
|
657
|
+
enumerable: true,
|
|
658
|
+
get: function get() {
|
|
659
|
+
return _fileStateFactory.simulateProcessed;
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
Object.defineProperty(exports, "simulateProcessing", {
|
|
663
|
+
enumerable: true,
|
|
664
|
+
get: function get() {
|
|
665
|
+
return _fileStateFactory.simulateProcessing;
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
Object.defineProperty(exports, "simulateUpdateFileId", {
|
|
669
|
+
enumerable: true,
|
|
670
|
+
get: function get() {
|
|
671
|
+
return _fileStateFactory.simulateUpdateFileId;
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
Object.defineProperty(exports, "simulateUpload", {
|
|
675
|
+
enumerable: true,
|
|
676
|
+
get: function get() {
|
|
677
|
+
return _fileStateFactory.simulateUpload;
|
|
678
|
+
}
|
|
679
|
+
});
|
|
614
680
|
Object.defineProperty(exports, "sleep", {
|
|
615
681
|
enumerable: true,
|
|
616
682
|
get: function get() {
|
|
@@ -671,6 +737,12 @@ Object.defineProperty(exports, "unmockFileReader", {
|
|
|
671
737
|
return _fileReader.unmockFileReader;
|
|
672
738
|
}
|
|
673
739
|
});
|
|
740
|
+
Object.defineProperty(exports, "useRunSimulation", {
|
|
741
|
+
enumerable: true,
|
|
742
|
+
get: function get() {
|
|
743
|
+
return _fileStateFactory.useRunSimulation;
|
|
744
|
+
}
|
|
745
|
+
});
|
|
674
746
|
Object.defineProperty(exports, "verticalImageFileId", {
|
|
675
747
|
enumerable: true,
|
|
676
748
|
get: function get() {
|
|
@@ -38,30 +38,28 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
38
38
|
response,
|
|
39
39
|
_args = arguments;
|
|
40
40
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
41
|
-
while (1) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return _context.stop();
|
|
64
|
-
}
|
|
41
|
+
while (1) switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
env = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'dev';
|
|
44
|
+
url = "https://media-playground.".concat(env, ".atl-paas.net/token/tenant?environment=").concat(authEnvironment);
|
|
45
|
+
body = JSON.stringify({
|
|
46
|
+
access: accessUrns[collectionName] || {}
|
|
47
|
+
});
|
|
48
|
+
headers = new Headers();
|
|
49
|
+
headers.append('Content-Type', 'application/json; charset=utf-8');
|
|
50
|
+
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
51
|
+
_context.next = 8;
|
|
52
|
+
return fetch(url, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
body: body,
|
|
55
|
+
headers: headers
|
|
56
|
+
});
|
|
57
|
+
case 8:
|
|
58
|
+
response = _context.sent;
|
|
59
|
+
return _context.abrupt("return", response.json());
|
|
60
|
+
case 10:
|
|
61
|
+
case "end":
|
|
62
|
+
return _context.stop();
|
|
65
63
|
}
|
|
66
64
|
}, _callee);
|
|
67
65
|
}));
|