@ama-sdk/client-fetch 11.3.0-prerelease.33

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.
Files changed (157) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +33 -0
  3. package/cjs/api-fetch-client.js +581 -0
  4. package/cjs/fetch-plugin.js +4 -0
  5. package/cjs/plugins/abort/abort.fetch.js +84 -0
  6. package/cjs/plugins/abort/abort.spec.js +204 -0
  7. package/cjs/plugins/abort/index.js +18 -0
  8. package/cjs/plugins/concurrent/concurrent.fetch.js +263 -0
  9. package/cjs/plugins/concurrent/concurrent.spec.js +239 -0
  10. package/cjs/plugins/concurrent/index.js +18 -0
  11. package/cjs/plugins/index.js +25 -0
  12. package/cjs/plugins/keepalive/index.js +18 -0
  13. package/cjs/plugins/keepalive/keepalive.request.js +289 -0
  14. package/cjs/plugins/keepalive/keepalive.spec.js +162 -0
  15. package/cjs/plugins/mock-intercept/index.js +19 -0
  16. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +288 -0
  17. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +4 -0
  18. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +445 -0
  19. package/cjs/plugins/perf-metric/index.js +18 -0
  20. package/cjs/plugins/perf-metric/perf-metric.fetch.js +371 -0
  21. package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +60 -0
  22. package/cjs/plugins/retry/index.js +18 -0
  23. package/cjs/plugins/retry/retry.fetch.js +371 -0
  24. package/cjs/plugins/retry/retry.spec.js +348 -0
  25. package/cjs/plugins/timeout/index.js +18 -0
  26. package/cjs/plugins/timeout/timeout.fetch.js +320 -0
  27. package/cjs/plugins/timeout/timeout.spec.js +443 -0
  28. package/cjs/plugins/wait-for/index.js +18 -0
  29. package/cjs/plugins/wait-for/wait-for.fetch.js +350 -0
  30. package/cjs/plugins/wait-for/wait-for.spec.js +383 -0
  31. package/cjs/public_api.js +20 -0
  32. package/collection.json +11 -0
  33. package/esm2015/api-fetch-client.js +571 -0
  34. package/esm2015/fetch-plugin.js +4 -0
  35. package/esm2015/plugins/abort/abort.fetch.js +74 -0
  36. package/esm2015/plugins/abort/abort.spec.js +200 -0
  37. package/esm2015/plugins/abort/index.js +1 -0
  38. package/esm2015/plugins/concurrent/concurrent.fetch.js +255 -0
  39. package/esm2015/plugins/concurrent/concurrent.spec.js +235 -0
  40. package/esm2015/plugins/concurrent/index.js +1 -0
  41. package/esm2015/plugins/index.js +8 -0
  42. package/esm2015/plugins/keepalive/index.js +1 -0
  43. package/esm2015/plugins/keepalive/keepalive.request.js +281 -0
  44. package/esm2015/plugins/keepalive/keepalive.spec.js +158 -0
  45. package/esm2015/plugins/mock-intercept/index.js +2 -0
  46. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +283 -0
  47. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +1 -0
  48. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +441 -0
  49. package/esm2015/plugins/perf-metric/index.js +1 -0
  50. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +363 -0
  51. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +56 -0
  52. package/esm2015/plugins/retry/index.js +1 -0
  53. package/esm2015/plugins/retry/retry.fetch.js +363 -0
  54. package/esm2015/plugins/retry/retry.spec.js +344 -0
  55. package/esm2015/plugins/timeout/index.js +1 -0
  56. package/esm2015/plugins/timeout/timeout.fetch.js +310 -0
  57. package/esm2015/plugins/timeout/timeout.spec.js +439 -0
  58. package/esm2015/plugins/wait-for/index.js +1 -0
  59. package/esm2015/plugins/wait-for/wait-for.fetch.js +379 -0
  60. package/esm2015/plugins/wait-for/wait-for.spec.js +379 -0
  61. package/esm2015/public_api.js +3 -0
  62. package/package.json +196 -0
  63. package/schematics/ng-add/index.d.ts +8 -0
  64. package/schematics/ng-add/index.d.ts.map +1 -0
  65. package/schematics/ng-add/index.js +67 -0
  66. package/schematics/ng-add/migration/import-map.d.ts +6 -0
  67. package/schematics/ng-add/migration/import-map.d.ts.map +1 -0
  68. package/schematics/ng-add/migration/import-map.js +39 -0
  69. package/schematics/ng-add/schema.d.ts +6 -0
  70. package/schematics/ng-add/schema.d.ts.map +1 -0
  71. package/schematics/ng-add/schema.js +3 -0
  72. package/schematics/ng-add/schema.json +18 -0
  73. package/schematics/package.json +3 -0
  74. package/src/api-fetch-client.d.ts +46 -0
  75. package/src/api-fetch-client.d.ts.map +1 -0
  76. package/src/api-fetch-client.js +126 -0
  77. package/src/api-fetch-client.js.map +1 -0
  78. package/src/fetch-plugin.d.ts +38 -0
  79. package/src/fetch-plugin.d.ts.map +1 -0
  80. package/src/fetch-plugin.js +2 -0
  81. package/src/fetch-plugin.js.map +1 -0
  82. package/src/plugins/abort/abort.fetch.d.ts +66 -0
  83. package/src/plugins/abort/abort.fetch.d.ts.map +1 -0
  84. package/src/plugins/abort/abort.fetch.js +32 -0
  85. package/src/plugins/abort/abort.fetch.js.map +1 -0
  86. package/src/plugins/abort/index.d.ts +2 -0
  87. package/src/plugins/abort/index.d.ts.map +1 -0
  88. package/src/plugins/abort/index.js +2 -0
  89. package/src/plugins/abort/index.js.map +1 -0
  90. package/src/plugins/concurrent/concurrent.fetch.d.ts +33 -0
  91. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -0
  92. package/src/plugins/concurrent/concurrent.fetch.js +57 -0
  93. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -0
  94. package/src/plugins/concurrent/index.d.ts +2 -0
  95. package/src/plugins/concurrent/index.d.ts.map +1 -0
  96. package/src/plugins/concurrent/index.js +2 -0
  97. package/src/plugins/concurrent/index.js.map +1 -0
  98. package/src/plugins/index.d.ts +9 -0
  99. package/src/plugins/index.d.ts.map +1 -0
  100. package/src/plugins/index.js +9 -0
  101. package/src/plugins/index.js.map +1 -0
  102. package/src/plugins/keepalive/index.d.ts +2 -0
  103. package/src/plugins/keepalive/index.d.ts.map +1 -0
  104. package/src/plugins/keepalive/index.js +2 -0
  105. package/src/plugins/keepalive/index.js.map +1 -0
  106. package/src/plugins/keepalive/keepalive.request.d.ts +18 -0
  107. package/src/plugins/keepalive/keepalive.request.d.ts.map +1 -0
  108. package/src/plugins/keepalive/keepalive.request.js +39 -0
  109. package/src/plugins/keepalive/keepalive.request.js.map +1 -0
  110. package/src/plugins/mock-intercept/index.d.ts +3 -0
  111. package/src/plugins/mock-intercept/index.d.ts.map +1 -0
  112. package/src/plugins/mock-intercept/index.js +3 -0
  113. package/src/plugins/mock-intercept/index.js.map +1 -0
  114. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts +15 -0
  115. package/src/plugins/mock-intercept/mock-intercept.fetch.d.ts.map +1 -0
  116. package/src/plugins/mock-intercept/mock-intercept.fetch.js +47 -0
  117. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -0
  118. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts +10 -0
  119. package/src/plugins/mock-intercept/mock-intercept.interface.d.ts.map +1 -0
  120. package/src/plugins/mock-intercept/mock-intercept.interface.js +2 -0
  121. package/src/plugins/mock-intercept/mock-intercept.interface.js.map +1 -0
  122. package/src/plugins/perf-metric/index.d.ts +2 -0
  123. package/src/plugins/perf-metric/index.d.ts.map +1 -0
  124. package/src/plugins/perf-metric/index.js +2 -0
  125. package/src/plugins/perf-metric/index.js.map +1 -0
  126. package/src/plugins/perf-metric/perf-metric.fetch.d.ts +133 -0
  127. package/src/plugins/perf-metric/perf-metric.fetch.d.ts.map +1 -0
  128. package/src/plugins/perf-metric/perf-metric.fetch.js +111 -0
  129. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -0
  130. package/src/plugins/retry/index.d.ts +2 -0
  131. package/src/plugins/retry/index.d.ts.map +1 -0
  132. package/src/plugins/retry/index.js +2 -0
  133. package/src/plugins/retry/index.js.map +1 -0
  134. package/src/plugins/retry/retry.fetch.d.ts +53 -0
  135. package/src/plugins/retry/retry.fetch.d.ts.map +1 -0
  136. package/src/plugins/retry/retry.fetch.js +66 -0
  137. package/src/plugins/retry/retry.fetch.js.map +1 -0
  138. package/src/plugins/timeout/index.d.ts +2 -0
  139. package/src/plugins/timeout/index.d.ts.map +1 -0
  140. package/src/plugins/timeout/index.js +2 -0
  141. package/src/plugins/timeout/index.js.map +1 -0
  142. package/src/plugins/timeout/timeout.fetch.d.ts +47 -0
  143. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -0
  144. package/src/plugins/timeout/timeout.fetch.js +105 -0
  145. package/src/plugins/timeout/timeout.fetch.js.map +1 -0
  146. package/src/plugins/wait-for/index.d.ts +2 -0
  147. package/src/plugins/wait-for/index.d.ts.map +1 -0
  148. package/src/plugins/wait-for/index.js +2 -0
  149. package/src/plugins/wait-for/index.js.map +1 -0
  150. package/src/plugins/wait-for/wait-for.fetch.d.ts +78 -0
  151. package/src/plugins/wait-for/wait-for.fetch.d.ts.map +1 -0
  152. package/src/plugins/wait-for/wait-for.fetch.js +104 -0
  153. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -0
  154. package/src/public_api.d.ts +4 -0
  155. package/src/public_api.d.ts.map +1 -0
  156. package/src/public_api.js +4 -0
  157. package/src/public_api.js.map +1 -0
@@ -0,0 +1,441 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _async_to_generator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ function _ts_generator(thisArg, body) {
44
+ var f, y, t, g, _ = {
45
+ label: 0,
46
+ sent: function() {
47
+ if (t[0] & 1) throw t[1];
48
+ return t[1];
49
+ },
50
+ trys: [],
51
+ ops: []
52
+ };
53
+ return g = {
54
+ next: verb(0),
55
+ "throw": verb(1),
56
+ "return": verb(2)
57
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
58
+ return this;
59
+ }), g;
60
+ function verb(n) {
61
+ return function(v) {
62
+ return step([
63
+ n,
64
+ v
65
+ ]);
66
+ };
67
+ }
68
+ function step(op) {
69
+ if (f) throw new TypeError("Generator is already executing.");
70
+ while(_)try {
71
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
72
+ if (y = 0, t) op = [
73
+ op[0] & 2,
74
+ t.value
75
+ ];
76
+ switch(op[0]){
77
+ case 0:
78
+ case 1:
79
+ t = op;
80
+ break;
81
+ case 4:
82
+ _.label++;
83
+ return {
84
+ value: op[1],
85
+ done: false
86
+ };
87
+ case 5:
88
+ _.label++;
89
+ y = op[1];
90
+ op = [
91
+ 0
92
+ ];
93
+ continue;
94
+ case 7:
95
+ op = _.ops.pop();
96
+ _.trys.pop();
97
+ continue;
98
+ default:
99
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
100
+ _ = 0;
101
+ continue;
102
+ }
103
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
104
+ _.label = op[1];
105
+ break;
106
+ }
107
+ if (op[0] === 6 && _.label < t[1]) {
108
+ _.label = t[1];
109
+ t = op;
110
+ break;
111
+ }
112
+ if (t && _.label < t[2]) {
113
+ _.label = t[2];
114
+ _.ops.push(op);
115
+ break;
116
+ }
117
+ if (t[2]) _.ops.pop();
118
+ _.trys.pop();
119
+ continue;
120
+ }
121
+ op = body.call(thisArg, _);
122
+ } catch (e) {
123
+ op = [
124
+ 6,
125
+ e
126
+ ];
127
+ y = 0;
128
+ } finally{
129
+ f = t = 0;
130
+ }
131
+ if (op[0] & 5) throw op[1];
132
+ return {
133
+ value: op[0] ? op[1] : void 0,
134
+ done: true
135
+ };
136
+ }
137
+ }
138
+ import { CUSTOM_MOCK_OPERATION_ID_HEADER, CUSTOM_MOCK_REQUEST_HEADER, MockInterceptRequest, SequentialMockAdapter } from '@ama-sdk/core';
139
+ import { MockInterceptFetch } from './mock-intercept.fetch';
140
+ var testMock = {
141
+ mockData: {}
142
+ };
143
+ var getMockSpy = jest.fn().mockReturnValue(testMock);
144
+ var getLatestMockSpy = jest.fn().mockReturnValue(testMock);
145
+ var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve('testOperation'));
146
+ var initializeSpy = jest.fn().mockReturnValue(Promise.resolve());
147
+ var testMockAdapter = {
148
+ getMock: getMockSpy,
149
+ getLatestMock: getLatestMockSpy,
150
+ initialize: initializeSpy,
151
+ retrieveOperationId: retrieveOperationIdSpy
152
+ };
153
+ var requestPlugins = [
154
+ new MockInterceptRequest({
155
+ adapter: new SequentialMockAdapter([], {})
156
+ })
157
+ ];
158
+ var apiClient = {
159
+ options: {
160
+ requestPlugins: requestPlugins,
161
+ basePath: 'test',
162
+ replyPlugins: []
163
+ }
164
+ };
165
+ describe('Mock intercept', function() {
166
+ beforeEach(function() {
167
+ return jest.clearAllMocks();
168
+ });
169
+ describe('request plugin', function() {
170
+ it('should do nothing if disabled is true', /*#__PURE__*/ _async_to_generator(function() {
171
+ var plugin, originalRequest, loaded;
172
+ return _ts_generator(this, function(_state) {
173
+ switch(_state.label){
174
+ case 0:
175
+ plugin = new MockInterceptRequest({
176
+ disabled: true,
177
+ adapter: testMockAdapter
178
+ });
179
+ originalRequest = {
180
+ method: 'get',
181
+ headers: new Headers({
182
+ test: 'true'
183
+ }),
184
+ basePath: 'myurl'
185
+ };
186
+ loaded = plugin.load();
187
+ return [
188
+ 4,
189
+ loaded.transform(originalRequest)
190
+ ];
191
+ case 1:
192
+ expect.apply(void 0, [
193
+ _state.sent()
194
+ ]).toEqual(originalRequest);
195
+ expect(initializeSpy).toHaveBeenCalled();
196
+ return [
197
+ 2
198
+ ];
199
+ }
200
+ });
201
+ }));
202
+ it('should not stringify provided api', /*#__PURE__*/ _async_to_generator(function() {
203
+ var plugin, loaded, originalRequest;
204
+ return _ts_generator(this, function(_state) {
205
+ switch(_state.label){
206
+ case 0:
207
+ plugin = new MockInterceptRequest({
208
+ disabled: false,
209
+ adapter: testMockAdapter
210
+ });
211
+ loaded = plugin.load();
212
+ originalRequest = {
213
+ method: 'get',
214
+ headers: new Headers({
215
+ test: 'true'
216
+ }),
217
+ basePath: 'myurl',
218
+ api: 'should not exist'
219
+ };
220
+ return [
221
+ 4,
222
+ loaded.transform(originalRequest)
223
+ ];
224
+ case 1:
225
+ _state.sent();
226
+ expect(originalRequest.headers.has(CUSTOM_MOCK_REQUEST_HEADER)).toBe(true);
227
+ expect(Object.keys(JSON.parse(originalRequest.headers.get(CUSTOM_MOCK_REQUEST_HEADER)))).not.toContainEqual('api');
228
+ return [
229
+ 2
230
+ ];
231
+ }
232
+ });
233
+ }));
234
+ it('should intercept the request', /*#__PURE__*/ _async_to_generator(function() {
235
+ var plugin, originalRequest, loaded, transformed, res;
236
+ return _ts_generator(this, function(_state) {
237
+ switch(_state.label){
238
+ case 0:
239
+ // Disabled because Blob URL is not supported on NodeJS
240
+ plugin = new MockInterceptRequest({
241
+ adapter: testMockAdapter
242
+ });
243
+ originalRequest = {
244
+ headers: new Headers({
245
+ test: 'true'
246
+ }),
247
+ basePath: 'myurl',
248
+ method: 'PATCH'
249
+ };
250
+ loaded = plugin.load();
251
+ return [
252
+ 4,
253
+ loaded.transform(originalRequest)
254
+ ];
255
+ case 1:
256
+ transformed = _state.sent();
257
+ return [
258
+ 4,
259
+ fetch(transformed.basePath, transformed)
260
+ ];
261
+ case 2:
262
+ return [
263
+ 4,
264
+ _state.sent().text()
265
+ ];
266
+ case 3:
267
+ res = _state.sent();
268
+ expect(getMockSpy).toHaveBeenCalled();
269
+ expect(res).toBe(JSON.stringify(testMock.mockData));
270
+ expect(initializeSpy).toHaveBeenCalled();
271
+ return [
272
+ 2
273
+ ];
274
+ }
275
+ });
276
+ }));
277
+ });
278
+ describe('fetch plugin', function() {
279
+ describe('when using an initialization function', function() {
280
+ var plugin;
281
+ var asyncMockAdapter;
282
+ beforeEach(function() {
283
+ asyncMockAdapter = {
284
+ initialize: initializeSpy,
285
+ getMock: getMockSpy,
286
+ getLatestMock: getLatestMockSpy,
287
+ retrieveOperationId: retrieveOperationIdSpy
288
+ };
289
+ plugin = new MockInterceptFetch({
290
+ adapter: asyncMockAdapter
291
+ });
292
+ });
293
+ it('should call initialize fn', /*#__PURE__*/ _async_to_generator(function() {
294
+ var loadedPlugin, testData;
295
+ return _ts_generator(this, function(_state) {
296
+ switch(_state.label){
297
+ case 0:
298
+ loadedPlugin = plugin.load({
299
+ controller: jest.fn(),
300
+ fetchPlugins: [],
301
+ url: 'myurl',
302
+ apiClient: apiClient,
303
+ options: {
304
+ headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
305
+ }
306
+ });
307
+ testData = {
308
+ test: true
309
+ };
310
+ return [
311
+ 4,
312
+ loadedPlugin.transform(Promise.resolve(testData))
313
+ ];
314
+ case 1:
315
+ _state.sent();
316
+ expect(initializeSpy).toHaveBeenCalled();
317
+ expect(getMockSpy).not.toHaveBeenCalled();
318
+ expect(getLatestMockSpy).toHaveBeenCalledWith('testOperation');
319
+ return [
320
+ 2
321
+ ];
322
+ }
323
+ });
324
+ }));
325
+ it('should throw if there is no request plugin', function() {
326
+ var config = {
327
+ controller: jest.fn(),
328
+ fetchPlugins: [],
329
+ url: 'myurl',
330
+ apiClient: {
331
+ options: {
332
+ requestPlugins: []
333
+ }
334
+ },
335
+ options: {
336
+ headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
337
+ }
338
+ };
339
+ expect(function() {
340
+ return plugin.load(config);
341
+ }).toThrow();
342
+ });
343
+ });
344
+ });
345
+ describe('with delay', function() {
346
+ it('should delay the response of the specific number', /*#__PURE__*/ _async_to_generator(function() {
347
+ var plugin, loadedPlugin, callback, run;
348
+ return _ts_generator(this, function(_state) {
349
+ switch(_state.label){
350
+ case 0:
351
+ plugin = new MockInterceptFetch({
352
+ adapter: testMockAdapter,
353
+ delayTiming: 700
354
+ });
355
+ loadedPlugin = plugin.load({
356
+ controller: jest.fn(),
357
+ fetchPlugins: [],
358
+ url: '',
359
+ apiClient: apiClient,
360
+ options: {
361
+ headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
362
+ }
363
+ });
364
+ callback = jest.fn();
365
+ run = loadedPlugin.transform(Promise.resolve({})).then(callback);
366
+ return [
367
+ 4,
368
+ jest.advanceTimersByTimeAsync(699)
369
+ ];
370
+ case 1:
371
+ _state.sent();
372
+ expect(callback).not.toHaveBeenCalled();
373
+ return [
374
+ 4,
375
+ jest.advanceTimersByTimeAsync(1)
376
+ ];
377
+ case 2:
378
+ _state.sent();
379
+ expect(callback).toHaveBeenCalled();
380
+ return [
381
+ 4,
382
+ run
383
+ ];
384
+ case 3:
385
+ _state.sent();
386
+ return [
387
+ 2
388
+ ];
389
+ }
390
+ });
391
+ }));
392
+ it('should delay the response based on callback', /*#__PURE__*/ _async_to_generator(function() {
393
+ var plugin, loadedPlugin, callback, run;
394
+ return _ts_generator(this, function(_state) {
395
+ switch(_state.label){
396
+ case 0:
397
+ plugin = new MockInterceptFetch({
398
+ adapter: testMockAdapter,
399
+ delayTiming: function() {
400
+ return 800;
401
+ }
402
+ });
403
+ loadedPlugin = plugin.load({
404
+ controller: jest.fn(),
405
+ fetchPlugins: [],
406
+ url: '',
407
+ apiClient: apiClient,
408
+ options: {
409
+ headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
410
+ }
411
+ });
412
+ callback = jest.fn();
413
+ run = loadedPlugin.transform(Promise.resolve({})).then(callback);
414
+ return [
415
+ 4,
416
+ jest.advanceTimersByTimeAsync(799)
417
+ ];
418
+ case 1:
419
+ _state.sent();
420
+ expect(callback).not.toHaveBeenCalled();
421
+ return [
422
+ 4,
423
+ jest.advanceTimersByTimeAsync(1)
424
+ ];
425
+ case 2:
426
+ _state.sent();
427
+ expect(callback).toHaveBeenCalled();
428
+ return [
429
+ 4,
430
+ run
431
+ ];
432
+ case 3:
433
+ _state.sent();
434
+ return [
435
+ 2
436
+ ];
437
+ }
438
+ });
439
+ }));
440
+ });
441
+ });
@@ -0,0 +1 @@
1
+ export * from './perf-metric.fetch';