@microsoft/1ds-core-js 3.1.3 → 3.1.7

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 (84) hide show
  1. package/README.md +1 -1
  2. package/bundle/ms.core-3.1.7.gbl.js +3589 -0
  3. package/bundle/ms.core-3.1.7.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.1.7.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.1.7.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.1.7.integrity.json +46 -0
  7. package/bundle/{ms.core-test.js → ms.core-3.1.7.js} +203 -100
  8. package/bundle/ms.core-3.1.7.js.map +1 -0
  9. package/bundle/ms.core-3.1.7.min.js +7 -0
  10. package/bundle/ms.core-3.1.7.min.js.map +1 -0
  11. package/bundle/{ms.core-3.1.3.gbl.js → ms.core.gbl.js} +201 -98
  12. package/bundle/ms.core.gbl.js.map +1 -0
  13. package/bundle/ms.core.gbl.min.js +7 -0
  14. package/bundle/ms.core.gbl.min.js.map +1 -0
  15. package/bundle/ms.core.integrity.json +46 -0
  16. package/bundle/{ms.core-3.1.3.js → ms.core.js} +202 -99
  17. package/bundle/ms.core.js.map +1 -0
  18. package/bundle/ms.core.min.js +7 -0
  19. package/bundle/ms.core.min.js.map +1 -0
  20. package/dist/ms.core.js +64 -68
  21. package/dist/ms.core.js.map +1 -1
  22. package/dist/ms.core.min.js +2 -2
  23. package/dist/ms.core.min.js.map +1 -1
  24. package/dist-esm/src/AppInsightsCore.js +1 -1
  25. package/dist-esm/src/BaseCore.js +1 -1
  26. package/dist-esm/src/DataModels.d.ts +5 -2
  27. package/dist-esm/src/DataModels.js +2 -1
  28. package/dist-esm/src/DataModels.js.map +1 -1
  29. package/dist-esm/src/ESPromise.js +1 -1
  30. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  31. package/dist-esm/src/Enums.d.ts +1 -0
  32. package/dist-esm/src/Enums.js +1 -1
  33. package/dist-esm/src/Index.d.ts +4 -3
  34. package/dist-esm/src/Index.js +6 -5
  35. package/dist-esm/src/Index.js.map +1 -1
  36. package/dist-esm/src/Utils.d.ts +33 -19
  37. package/dist-esm/src/Utils.js +86 -75
  38. package/dist-esm/src/Utils.js.map +1 -1
  39. package/dist-esm/src/ValueSanitizer.js +1 -1
  40. package/package.json +6 -6
  41. package/src/DataModels.ts +5 -2
  42. package/src/Index.ts +10 -10
  43. package/src/Utils.ts +100 -84
  44. package/tsconfig.json +2 -4
  45. package/bundle/ms.core-3.1.3.gbl.js.map +0 -1
  46. package/bundle/ms.core-3.1.3.gbl.min.js +0 -7
  47. package/bundle/ms.core-3.1.3.gbl.min.js.map +0 -1
  48. package/bundle/ms.core-3.1.3.js.map +0 -1
  49. package/bundle/ms.core-3.1.3.min.js +0 -7
  50. package/bundle/ms.core-3.1.3.min.js.map +0 -1
  51. package/bundle/ms.core-test.js.map +0 -1
  52. package/bundle/ms.core-test.min.js +0 -7
  53. package/bundle/ms.core-test.min.js.map +0 -1
  54. package/dist-esm/test/CoreTest.d.ts +0 -6
  55. package/dist-esm/test/CoreTest.js +0 -105
  56. package/dist-esm/test/CoreTest.js.map +0 -1
  57. package/dist-esm/test/DynamicProtoTests.d.ts +0 -7
  58. package/dist-esm/test/DynamicProtoTests.js +0 -541
  59. package/dist-esm/test/DynamicProtoTests.js.map +0 -1
  60. package/dist-esm/test/ESPromiseSchedulerTests.d.ts +0 -6
  61. package/dist-esm/test/ESPromiseSchedulerTests.js +0 -190
  62. package/dist-esm/test/ESPromiseSchedulerTests.js.map +0 -1
  63. package/dist-esm/test/ESPromiseTests.d.ts +0 -5
  64. package/dist-esm/test/ESPromiseTests.js +0 -422
  65. package/dist-esm/test/ESPromiseTests.js.map +0 -1
  66. package/dist-esm/test/FileSizeCheckTest.d.ts +0 -5
  67. package/dist-esm/test/FileSizeCheckTest.js +0 -42
  68. package/dist-esm/test/FileSizeCheckTest.js.map +0 -1
  69. package/dist-esm/test/Index.d.ts +0 -1
  70. package/dist-esm/test/Index.js +0 -23
  71. package/dist-esm/test/Index.js.map +0 -1
  72. package/dist-esm/test/TestClass.d.ts +0 -103
  73. package/dist-esm/test/TestClass.js +0 -396
  74. package/dist-esm/test/TestClass.js.map +0 -1
  75. package/dist-esm/test/TestHelper.d.ts +0 -7
  76. package/dist-esm/test/TestHelper.js +0 -98
  77. package/dist-esm/test/TestHelper.js.map +0 -1
  78. package/dist-esm/test/UtilsTest.d.ts +0 -4
  79. package/dist-esm/test/UtilsTest.js +0 -224
  80. package/dist-esm/test/UtilsTest.js.map +0 -1
  81. package/dist-esm/test/ValueSanitizerTests.d.ts +0 -6
  82. package/dist-esm/test/ValueSanitizerTests.js +0 -331
  83. package/dist-esm/test/ValueSanitizerTests.js.map +0 -1
  84. package/src/typings/XDomainRequest.d.ts +0 -23
@@ -1,422 +0,0 @@
1
- /*
2
- * 1DS JS SDK Core, 3.1.3
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
7
- import { TestClass } from './TestClass';
8
- import { ESPromise } from '../src/Index';
9
- import * as sinon from 'sinon';
10
- var ESPromiseTests = /** @class */ (function (_super) {
11
- __extends(ESPromiseTests, _super);
12
- function ESPromiseTests() {
13
- return _super !== null && _super.apply(this, arguments) || this;
14
- }
15
- ESPromiseTests.prototype.testInitialize = function () {
16
- };
17
- ESPromiseTests.prototype.registerTests = function () {
18
- this.testCase({
19
- name: "Test promise with invalid resolver",
20
- test: function () {
21
- var clock = sinon.useFakeTimers();
22
- try {
23
- try {
24
- var promise = new ESPromise(undefined);
25
- QUnit.assert.ok(false, "expected an exception to be thrown with undefined");
26
- }
27
- catch (e) {
28
- QUnit.assert.ok(e.message.indexOf("resolvedFunc argument is not a Function") != -1, "Expected the exception message to include reason for failure");
29
- }
30
- try {
31
- var promise = new ESPromise(null);
32
- QUnit.assert.ok(false, "expected an exception to be thrown with null");
33
- }
34
- catch (e) {
35
- QUnit.assert.ok(e.message.indexOf("resolvedFunc argument is not a Function") != -1, "Expected the exception message to include reason for failure");
36
- }
37
- try {
38
- var promise = new ESPromise(42);
39
- QUnit.assert.ok(false, "expected an exception to be thrown with null");
40
- }
41
- catch (e) {
42
- QUnit.assert.ok(e.message.indexOf("resolvedFunc argument is not a Function") != -1, "Expected the exception message to include reason for failure");
43
- }
44
- }
45
- finally {
46
- clock.restore();
47
- }
48
- }
49
- });
50
- this.testCase({
51
- name: "Test resolving promise",
52
- test: function () {
53
- var clock = sinon.useFakeTimers();
54
- var promise = null;
55
- try {
56
- var resolvedValue_1 = null;
57
- var rejectedValue_1 = null;
58
- promise = new ESPromise(function (resolve, reject) {
59
- resolve(42);
60
- }).then(function (value) {
61
- resolvedValue_1 = value;
62
- }, function (value) {
63
- rejectedValue_1 = value;
64
- });
65
- // Should not be resolved or rejected yet as this should happen asynchronously
66
- QUnit.assert.equal(resolvedValue_1, null, "Expected the promise to not be resolved yet");
67
- QUnit.assert.equal(rejectedValue_1, null, "Expected the promise to not be rejected yet");
68
- // Cause the async promise execution to occur
69
- clock.tick(100);
70
- QUnit.assert.equal(resolvedValue_1, 42, "Expected the promise to be resolved");
71
- QUnit.assert.equal(rejectedValue_1, null, "Expected the promise to not be rejected");
72
- resolvedValue_1 = null;
73
- rejectedValue_1 = null;
74
- promise = new ESPromise(function (resolve, reject) {
75
- resolve(42);
76
- }).then(function (value) {
77
- resolvedValue_1 = value;
78
- })["catch"](function (value) {
79
- rejectedValue_1 = value;
80
- });
81
- // Should not be resolved or rejected yet as this should happen asynchronously
82
- QUnit.assert.equal(resolvedValue_1, null, "Expected the promise to not be resolved yet");
83
- QUnit.assert.equal(rejectedValue_1, null, "Expected the promise to not be rejected yet");
84
- // Cause the async promise execution to occur
85
- clock.tick(100);
86
- QUnit.assert.equal(resolvedValue_1, 42, "Expected the promise to be resolved");
87
- QUnit.assert.equal(rejectedValue_1, null, "Expected the promise to not be rejected");
88
- }
89
- finally {
90
- clock.restore();
91
- }
92
- }
93
- });
94
- this.testCase({
95
- name: "Test rejecting promise",
96
- test: function () {
97
- var clock = sinon.useFakeTimers();
98
- var promise = null;
99
- try {
100
- var resolvedValue_2 = null;
101
- var rejectedValue_2 = null;
102
- promise = new ESPromise(function (resolve, reject) {
103
- reject(-42);
104
- }).then(function (value) {
105
- resolvedValue_2 = value;
106
- }, function (value) {
107
- rejectedValue_2 = value;
108
- });
109
- // Should not be resolved or rejected yet as this should happen asynchronously
110
- QUnit.assert.equal(resolvedValue_2, null, "Expected the promise to not be resolved yet");
111
- QUnit.assert.equal(rejectedValue_2, null, "Expected the promise to not be rejected yet");
112
- // Cause the async promise execution to occur
113
- clock.tick(100);
114
- QUnit.assert.equal(resolvedValue_2, null, "Expected the promise to not be resolved");
115
- QUnit.assert.equal(rejectedValue_2, -42, "Expected the promise to be rejected");
116
- resolvedValue_2 = null;
117
- rejectedValue_2 = null;
118
- promise = new ESPromise(function (resolve, reject) {
119
- reject(-42);
120
- }).then(function (value) {
121
- resolvedValue_2 = value;
122
- })["catch"](function (value) {
123
- rejectedValue_2 = value;
124
- });
125
- // Should not be resolved or rejected yet as this should happen asynchronously
126
- QUnit.assert.equal(resolvedValue_2, null, "Expected the promise to not be resolved yet");
127
- QUnit.assert.equal(rejectedValue_2, null, "Expected the promise to not be rejected yet");
128
- // Cause the async promise execution to occur
129
- clock.tick(100);
130
- QUnit.assert.equal(resolvedValue_2, null, "Expected the promise to not be resolved");
131
- QUnit.assert.equal(rejectedValue_2, -42, "Expected the promise to be rejected");
132
- }
133
- finally {
134
- clock.restore();
135
- }
136
- }
137
- });
138
- this.testCase({
139
- name: "Test rejecting promise by throwing",
140
- test: function () {
141
- var clock = sinon.useFakeTimers();
142
- var promise = null;
143
- try {
144
- var resolvedValue_3 = null;
145
- var rejectedValue_3 = null;
146
- promise = new ESPromise(function (resolve, reject) {
147
- throw new Error("Simulated failure!");
148
- }).then(function (value) {
149
- resolvedValue_3 = value;
150
- }, function (value) {
151
- rejectedValue_3 = value;
152
- });
153
- // Should not be resolved or rejected yet as this should happen asynchronously
154
- QUnit.assert.equal(resolvedValue_3, null, "Expected the promise to not be resolved yet");
155
- QUnit.assert.equal(rejectedValue_3, null, "Expected the promise to not be rejected yet");
156
- // Cause the async promise execution to occur
157
- clock.tick(100);
158
- QUnit.assert.equal(resolvedValue_3, null, "Expected the promise to not be resolved");
159
- QUnit.assert.ok(rejectedValue_3 != null, "Expected the promise to be rejected with a value");
160
- QUnit.assert.ok(rejectedValue_3.message.indexOf("Simulated failure!") != -1, "Expected the promise to be rejected with the contained exception");
161
- resolvedValue_3 = null;
162
- rejectedValue_3 = null;
163
- promise = new ESPromise(function (resolve, reject) {
164
- throw new Error("Simulated failure!");
165
- }).then(function (value) {
166
- resolvedValue_3 = value;
167
- })["catch"](function (value) {
168
- rejectedValue_3 = value;
169
- });
170
- // Should not be resolved or rejected yet as this should happen asynchronously
171
- QUnit.assert.equal(resolvedValue_3, null, "Expected the promise to not be resolved yet");
172
- QUnit.assert.equal(rejectedValue_3, null, "Expected the promise to not be rejected yet");
173
- // Cause the async promise execution to occur
174
- clock.tick(100);
175
- QUnit.assert.equal(resolvedValue_3, null, "Expected the promise to not be resolved");
176
- QUnit.assert.ok(rejectedValue_3 != null, "Expected the promise to be rejected with a value");
177
- QUnit.assert.ok(rejectedValue_3.message.indexOf("Simulated failure!") != -1, "Expected the promise to be rejected with the contained exception");
178
- }
179
- finally {
180
- clock.restore();
181
- }
182
- }
183
- });
184
- this.testCase({
185
- name: "Test resolving promise with a returned value",
186
- test: function () {
187
- var clock = sinon.useFakeTimers();
188
- var promise = null;
189
- var subPromise = null;
190
- try {
191
- var resolvedValue_4 = null;
192
- promise = new ESPromise(function (resolve, reject) {
193
- resolve(42);
194
- }).then(function (value) {
195
- return 53;
196
- }).then(function (value) {
197
- resolvedValue_4 = value;
198
- });
199
- // Should not be resolved or rejected yet as this should happen asynchronously
200
- QUnit.assert.equal(resolvedValue_4, null, "Expected the promise to not be resolved yet");
201
- // Cause the async promise execution to occur
202
- clock.tick(100);
203
- QUnit.assert.equal(resolvedValue_4, 53, "Expected the promise to be resolved with the returned value not the initial resolved value");
204
- resolvedValue_4 = null;
205
- promise = new ESPromise(function (resolve, reject) {
206
- resolve(42);
207
- }).then(function (value) {
208
- // Don't return anything
209
- }).then(function (value) {
210
- resolvedValue_4 = value;
211
- });
212
- // Should not be resolved or rejected yet as this should happen asynchronously
213
- QUnit.assert.equal(resolvedValue_4, null, "Expected the promise to not be resolved yet");
214
- // Cause the async promise execution to occur
215
- clock.tick(100);
216
- QUnit.assert.equal(resolvedValue_4, undefined, "Expected the promise to be resolved with undefined from the Promise returned by the initial then");
217
- }
218
- finally {
219
- clock.restore();
220
- }
221
- }
222
- });
223
- this.testCase({
224
- name: "Test resolving promise with a promise",
225
- test: function () {
226
- var clock = sinon.useFakeTimers();
227
- var promise = null;
228
- var preResolved = ESPromise.resolve(53);
229
- var preRejected = ESPromise.reject(new Error("Simulated Pre Rejected Promise"));
230
- try {
231
- var resolvedValue_5 = null;
232
- var rejectedValue_4 = null;
233
- promise = new ESPromise(function (resolve, reject) {
234
- resolve(42);
235
- }).then(function (value) {
236
- return preResolved;
237
- }).then(function (value) {
238
- resolvedValue_5 = value;
239
- }, function (value) {
240
- rejectedValue_4 = value;
241
- });
242
- // Should not be resolved or rejected yet as this should happen asynchronously
243
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to not be resolved yet");
244
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
245
- // Cause the async promise execution to occur
246
- clock.tick(100);
247
- QUnit.assert.equal(resolvedValue_5, 53, "Expected the promise to be resolved");
248
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
249
- resolvedValue_5 = null;
250
- rejectedValue_4 = null;
251
- promise = new ESPromise(function (resolve, reject) {
252
- resolve(42);
253
- }).then(function (value) {
254
- return preRejected;
255
- }).then(function (value) {
256
- resolvedValue_5 = value;
257
- }, function (value) {
258
- rejectedValue_4 = value;
259
- });
260
- // Should not be resolved or rejected yet as this should happen asynchronously
261
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to not be resolved yet");
262
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
263
- // Cause the async promise execution to occur
264
- clock.tick(100);
265
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to be resolved");
266
- QUnit.assert.ok(rejectedValue_4 != null, "Expected the promise to be rejected with a value");
267
- QUnit.assert.ok(rejectedValue_4.message.indexOf("Simulated Pre Rejected Promise") != -1, "Expected the promise to be rejected with the contained exception");
268
- var unresolvedPromise_1 = new ESPromise(function (resolve, reject) {
269
- setTimeout(function () {
270
- resolve(68);
271
- }, 2000);
272
- });
273
- resolvedValue_5 = null;
274
- rejectedValue_4 = null;
275
- promise = new ESPromise(function (resolve, reject) {
276
- resolve(42);
277
- }).then(function (value) {
278
- return unresolvedPromise_1;
279
- }).then(function (value) {
280
- resolvedValue_5 = value;
281
- }, function (value) {
282
- rejectedValue_4 = value;
283
- });
284
- // Should not be resolved or rejected yet as this should happen asynchronously
285
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to not be resolved yet");
286
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
287
- // Cause the async promise execution to occur, but not enough for the unresolved promise
288
- clock.tick(100);
289
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to not be resolved yet");
290
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
291
- // let some more time pass but still not enough for the unresolved promise
292
- clock.tick(1000);
293
- QUnit.assert.equal(resolvedValue_5, null, "Expected the promise to not be resolved yet");
294
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
295
- // Now lets trigger the unresolved promise
296
- clock.tick(1000);
297
- QUnit.assert.equal(resolvedValue_5, 68, "Expected the promise to be resolved");
298
- QUnit.assert.equal(rejectedValue_4, null, "Expected the promise to not be rejected yet");
299
- }
300
- finally {
301
- clock.restore();
302
- }
303
- }
304
- });
305
- this.testCase({
306
- name: "Testing waiting for multiple promises",
307
- test: function () {
308
- var clock = sinon.useFakeTimers();
309
- try {
310
- var workerPromises = [];
311
- var workerResolved_1 = [];
312
- var resolvedValue_6 = null;
313
- var _loop_1 = function (lp) {
314
- workerResolved_1[lp] = false;
315
- workerPromises[lp] = new ESPromise(function (resolve, reject) {
316
- setTimeout(function () {
317
- // Wait to resolve this promise
318
- workerResolved_1[lp] = true;
319
- resolve(lp);
320
- }, (lp + 1) * 1000);
321
- });
322
- };
323
- // Create the promises
324
- for (var lp = 0; lp < 10; lp++) {
325
- _loop_1(lp);
326
- }
327
- // Create the uber waiting promise
328
- var thePromise = ESPromise.all(workerPromises);
329
- thePromise.then(function (value) {
330
- resolvedValue_6 = value;
331
- });
332
- QUnit.assert.equal(resolvedValue_6, null, "Expected the promise to not be resolved yet");
333
- for (var lp = 0; lp < 10; lp++) {
334
- clock.tick(100);
335
- QUnit.assert.equal(workerResolved_1[lp], false, "Worker not resolved yet");
336
- QUnit.assert.equal(resolvedValue_6, null, "Expected the promise to not be resolved yet - " + lp);
337
- clock.tick(899);
338
- QUnit.assert.equal(workerResolved_1[lp], false, "Worker not resolved yet");
339
- QUnit.assert.equal(resolvedValue_6, null, "Expected the promise to not be resolved yet - " + lp);
340
- // This will cause the worker promise to get resolved
341
- clock.tick(1);
342
- QUnit.assert.equal(workerResolved_1[lp], true, "Worker now resolved");
343
- }
344
- QUnit.assert.equal(resolvedValue_6, null, "Expected the promise to not be resolved yet");
345
- clock.tick(50);
346
- QUnit.assert.ok(resolvedValue_6 != null, "Expected the promise to be resolved");
347
- for (var lp = 0; lp < 10; lp++) {
348
- QUnit.assert.equal(resolvedValue_6[lp], lp, "Value mismatch");
349
- }
350
- }
351
- finally {
352
- clock.restore();
353
- }
354
- }
355
- });
356
- this.testCase({
357
- name: "Testing waiting for multiple promises where one rejects",
358
- test: function () {
359
- var clock = sinon.useFakeTimers();
360
- try {
361
- var workerPromises = [];
362
- var workerResolved_2 = [];
363
- var resolvedValue_7 = null;
364
- var rejectedValue_5 = null;
365
- var _loop_2 = function (lp) {
366
- workerResolved_2[lp] = false;
367
- workerPromises[lp] = new ESPromise(function (resolve, reject) {
368
- setTimeout(function () {
369
- // Wait to resolve this promise
370
- workerResolved_2[lp] = true;
371
- if (lp == 5) {
372
- reject(new Error("Simulated Rejection"));
373
- return;
374
- }
375
- resolve(lp);
376
- }, (lp + 1) * 1000);
377
- });
378
- };
379
- // Create the promises
380
- for (var lp = 0; lp < 10; lp++) {
381
- _loop_2(lp);
382
- }
383
- // Create the uber waiting promise
384
- var thePromise = ESPromise.all(workerPromises);
385
- thePromise.then(function (value) {
386
- resolvedValue_7 = value;
387
- }, function (value) {
388
- rejectedValue_5 = value;
389
- });
390
- QUnit.assert.equal(resolvedValue_7, null, "Expected the promise to not be resolved yet");
391
- QUnit.assert.equal(rejectedValue_5, null, "Expected the promise to not be rejected yet");
392
- for (var lp = 0; lp < 5; lp++) {
393
- clock.tick(100);
394
- QUnit.assert.equal(workerResolved_2[lp], false, "Worker not resolved yet");
395
- QUnit.assert.equal(resolvedValue_7, null, "Expected the promise to not be resolved yet - " + lp);
396
- QUnit.assert.equal(rejectedValue_5, null, "Expected the promise to not be rejected yet - " + lp);
397
- clock.tick(899);
398
- QUnit.assert.equal(workerResolved_2[lp], false, "Worker not resolved yet");
399
- QUnit.assert.equal(resolvedValue_7, null, "Expected the promise to not be resolved yet - " + lp);
400
- QUnit.assert.equal(rejectedValue_5, null, "Expected the promise to not be rejected yet - " + lp);
401
- // This will cause the worker promise to get resolved
402
- clock.tick(1);
403
- QUnit.assert.equal(workerResolved_2[lp], true, "Worker now resolved");
404
- }
405
- QUnit.assert.equal(resolvedValue_7, null, "Expected the promise to not be resolved yet");
406
- QUnit.assert.equal(rejectedValue_5, null, "Expected the promise to not be rejected yet");
407
- // Now lets cause the rejected promise to run
408
- clock.tick(1500);
409
- QUnit.assert.ok(resolvedValue_7 == null, "Expected the promise to not be resolved");
410
- QUnit.assert.ok(rejectedValue_5 != null, "Expected the promise to be rejected");
411
- QUnit.assert.ok(rejectedValue_5.message.indexOf("Simulated Rejection") != -1, "Main promise should have rejected with the rejected error");
412
- }
413
- finally {
414
- clock.restore();
415
- }
416
- }
417
- });
418
- };
419
- return ESPromiseTests;
420
- }(TestClass));
421
- export { ESPromiseTests };
422
- //# sourceMappingURL=ESPromiseTests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ESPromiseTests.js.map","sources":["ESPromiseTests.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\nimport { TestClass } from './TestClass';\r\nimport { ESPromise } from '../src/Index';\r\nimport * as sinon from 'sinon';\r\nvar ESPromiseTests = /** @class */ (function (_super) {\r\n __extends(ESPromiseTests, _super);\r\n function ESPromiseTests() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ESPromiseTests.prototype.testInitialize = function () {\r\n };\r\n ESPromiseTests.prototype.registerTests = function () {\r\n this.testCase({\r\n name: \"Test promise with invalid resolver\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n try {\r\n try {\r\n var promise = new ESPromise(undefined);\r\n QUnit.assert.ok(false, \"expected an exception to be thrown with undefined\");\r\n }\r\n catch (e) {\r\n QUnit.assert.ok(e.message.indexOf(\"resolvedFunc argument is not a Function\") != -1, \"Expected the exception message to include reason for failure\");\r\n }\r\n try {\r\n var promise = new ESPromise(null);\r\n QUnit.assert.ok(false, \"expected an exception to be thrown with null\");\r\n }\r\n catch (e) {\r\n QUnit.assert.ok(e.message.indexOf(\"resolvedFunc argument is not a Function\") != -1, \"Expected the exception message to include reason for failure\");\r\n }\r\n try {\r\n var promise = new ESPromise(42);\r\n QUnit.assert.ok(false, \"expected an exception to be thrown with null\");\r\n }\r\n catch (e) {\r\n QUnit.assert.ok(e.message.indexOf(\"resolvedFunc argument is not a Function\") != -1, \"Expected the exception message to include reason for failure\");\r\n }\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Test resolving promise\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n var promise = null;\r\n try {\r\n var resolvedValue_1 = null;\r\n var rejectedValue_1 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n resolvedValue_1 = value;\r\n }, function (value) {\r\n rejectedValue_1 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_1, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_1, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_1, 42, \"Expected the promise to be resolved\");\r\n QUnit.assert.equal(rejectedValue_1, null, \"Expected the promise to not be rejected\");\r\n resolvedValue_1 = null;\r\n rejectedValue_1 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n resolvedValue_1 = value;\r\n })[\"catch\"](function (value) {\r\n rejectedValue_1 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_1, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_1, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_1, 42, \"Expected the promise to be resolved\");\r\n QUnit.assert.equal(rejectedValue_1, null, \"Expected the promise to not be rejected\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Test rejecting promise\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n var promise = null;\r\n try {\r\n var resolvedValue_2 = null;\r\n var rejectedValue_2 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n reject(-42);\r\n }).then(function (value) {\r\n resolvedValue_2 = value;\r\n }, function (value) {\r\n rejectedValue_2 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_2, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_2, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_2, null, \"Expected the promise to not be resolved\");\r\n QUnit.assert.equal(rejectedValue_2, -42, \"Expected the promise to be rejected\");\r\n resolvedValue_2 = null;\r\n rejectedValue_2 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n reject(-42);\r\n }).then(function (value) {\r\n resolvedValue_2 = value;\r\n })[\"catch\"](function (value) {\r\n rejectedValue_2 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_2, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_2, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_2, null, \"Expected the promise to not be resolved\");\r\n QUnit.assert.equal(rejectedValue_2, -42, \"Expected the promise to be rejected\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Test rejecting promise by throwing\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n var promise = null;\r\n try {\r\n var resolvedValue_3 = null;\r\n var rejectedValue_3 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n throw new Error(\"Simulated failure!\");\r\n }).then(function (value) {\r\n resolvedValue_3 = value;\r\n }, function (value) {\r\n rejectedValue_3 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_3, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_3, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_3, null, \"Expected the promise to not be resolved\");\r\n QUnit.assert.ok(rejectedValue_3 != null, \"Expected the promise to be rejected with a value\");\r\n QUnit.assert.ok(rejectedValue_3.message.indexOf(\"Simulated failure!\") != -1, \"Expected the promise to be rejected with the contained exception\");\r\n resolvedValue_3 = null;\r\n rejectedValue_3 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n throw new Error(\"Simulated failure!\");\r\n }).then(function (value) {\r\n resolvedValue_3 = value;\r\n })[\"catch\"](function (value) {\r\n rejectedValue_3 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_3, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_3, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_3, null, \"Expected the promise to not be resolved\");\r\n QUnit.assert.ok(rejectedValue_3 != null, \"Expected the promise to be rejected with a value\");\r\n QUnit.assert.ok(rejectedValue_3.message.indexOf(\"Simulated failure!\") != -1, \"Expected the promise to be rejected with the contained exception\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Test resolving promise with a returned value\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n var promise = null;\r\n var subPromise = null;\r\n try {\r\n var resolvedValue_4 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n return 53;\r\n }).then(function (value) {\r\n resolvedValue_4 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_4, null, \"Expected the promise to not be resolved yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_4, 53, \"Expected the promise to be resolved with the returned value not the initial resolved value\");\r\n resolvedValue_4 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n // Don't return anything\r\n }).then(function (value) {\r\n resolvedValue_4 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_4, null, \"Expected the promise to not be resolved yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_4, undefined, \"Expected the promise to be resolved with undefined from the Promise returned by the initial then\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Test resolving promise with a promise\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n var promise = null;\r\n var preResolved = ESPromise.resolve(53);\r\n var preRejected = ESPromise.reject(new Error(\"Simulated Pre Rejected Promise\"));\r\n try {\r\n var resolvedValue_5 = null;\r\n var rejectedValue_4 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n return preResolved;\r\n }).then(function (value) {\r\n resolvedValue_5 = value;\r\n }, function (value) {\r\n rejectedValue_4 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_5, 53, \"Expected the promise to be resolved\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n resolvedValue_5 = null;\r\n rejectedValue_4 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n return preRejected;\r\n }).then(function (value) {\r\n resolvedValue_5 = value;\r\n }, function (value) {\r\n rejectedValue_4 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to be resolved\");\r\n QUnit.assert.ok(rejectedValue_4 != null, \"Expected the promise to be rejected with a value\");\r\n QUnit.assert.ok(rejectedValue_4.message.indexOf(\"Simulated Pre Rejected Promise\") != -1, \"Expected the promise to be rejected with the contained exception\");\r\n var unresolvedPromise_1 = new ESPromise(function (resolve, reject) {\r\n setTimeout(function () {\r\n resolve(68);\r\n }, 2000);\r\n });\r\n resolvedValue_5 = null;\r\n rejectedValue_4 = null;\r\n promise = new ESPromise(function (resolve, reject) {\r\n resolve(42);\r\n }).then(function (value) {\r\n return unresolvedPromise_1;\r\n }).then(function (value) {\r\n resolvedValue_5 = value;\r\n }, function (value) {\r\n rejectedValue_4 = value;\r\n });\r\n // Should not be resolved or rejected yet as this should happen asynchronously\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n // Cause the async promise execution to occur, but not enough for the unresolved promise\r\n clock.tick(100);\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n // let some more time pass but still not enough for the unresolved promise\r\n clock.tick(1000);\r\n QUnit.assert.equal(resolvedValue_5, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n // Now lets trigger the unresolved promise\r\n clock.tick(1000);\r\n QUnit.assert.equal(resolvedValue_5, 68, \"Expected the promise to be resolved\");\r\n QUnit.assert.equal(rejectedValue_4, null, \"Expected the promise to not be rejected yet\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Testing waiting for multiple promises\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n try {\r\n var workerPromises = [];\r\n var workerResolved_1 = [];\r\n var resolvedValue_6 = null;\r\n var _loop_1 = function (lp) {\r\n workerResolved_1[lp] = false;\r\n workerPromises[lp] = new ESPromise(function (resolve, reject) {\r\n setTimeout(function () {\r\n // Wait to resolve this promise\r\n workerResolved_1[lp] = true;\r\n resolve(lp);\r\n }, (lp + 1) * 1000);\r\n });\r\n };\r\n // Create the promises\r\n for (var lp = 0; lp < 10; lp++) {\r\n _loop_1(lp);\r\n }\r\n // Create the uber waiting promise\r\n var thePromise = ESPromise.all(workerPromises);\r\n thePromise.then(function (value) {\r\n resolvedValue_6 = value;\r\n });\r\n QUnit.assert.equal(resolvedValue_6, null, \"Expected the promise to not be resolved yet\");\r\n for (var lp = 0; lp < 10; lp++) {\r\n clock.tick(100);\r\n QUnit.assert.equal(workerResolved_1[lp], false, \"Worker not resolved yet\");\r\n QUnit.assert.equal(resolvedValue_6, null, \"Expected the promise to not be resolved yet - \" + lp);\r\n clock.tick(899);\r\n QUnit.assert.equal(workerResolved_1[lp], false, \"Worker not resolved yet\");\r\n QUnit.assert.equal(resolvedValue_6, null, \"Expected the promise to not be resolved yet - \" + lp);\r\n // This will cause the worker promise to get resolved\r\n clock.tick(1);\r\n QUnit.assert.equal(workerResolved_1[lp], true, \"Worker now resolved\");\r\n }\r\n QUnit.assert.equal(resolvedValue_6, null, \"Expected the promise to not be resolved yet\");\r\n clock.tick(50);\r\n QUnit.assert.ok(resolvedValue_6 != null, \"Expected the promise to be resolved\");\r\n for (var lp = 0; lp < 10; lp++) {\r\n QUnit.assert.equal(resolvedValue_6[lp], lp, \"Value mismatch\");\r\n }\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n this.testCase({\r\n name: \"Testing waiting for multiple promises where one rejects\",\r\n test: function () {\r\n var clock = sinon.useFakeTimers();\r\n try {\r\n var workerPromises = [];\r\n var workerResolved_2 = [];\r\n var resolvedValue_7 = null;\r\n var rejectedValue_5 = null;\r\n var _loop_2 = function (lp) {\r\n workerResolved_2[lp] = false;\r\n workerPromises[lp] = new ESPromise(function (resolve, reject) {\r\n setTimeout(function () {\r\n // Wait to resolve this promise\r\n workerResolved_2[lp] = true;\r\n if (lp == 5) {\r\n reject(new Error(\"Simulated Rejection\"));\r\n return;\r\n }\r\n resolve(lp);\r\n }, (lp + 1) * 1000);\r\n });\r\n };\r\n // Create the promises\r\n for (var lp = 0; lp < 10; lp++) {\r\n _loop_2(lp);\r\n }\r\n // Create the uber waiting promise\r\n var thePromise = ESPromise.all(workerPromises);\r\n thePromise.then(function (value) {\r\n resolvedValue_7 = value;\r\n }, function (value) {\r\n rejectedValue_5 = value;\r\n });\r\n QUnit.assert.equal(resolvedValue_7, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_5, null, \"Expected the promise to not be rejected yet\");\r\n for (var lp = 0; lp < 5; lp++) {\r\n clock.tick(100);\r\n QUnit.assert.equal(workerResolved_2[lp], false, \"Worker not resolved yet\");\r\n QUnit.assert.equal(resolvedValue_7, null, \"Expected the promise to not be resolved yet - \" + lp);\r\n QUnit.assert.equal(rejectedValue_5, null, \"Expected the promise to not be rejected yet - \" + lp);\r\n clock.tick(899);\r\n QUnit.assert.equal(workerResolved_2[lp], false, \"Worker not resolved yet\");\r\n QUnit.assert.equal(resolvedValue_7, null, \"Expected the promise to not be resolved yet - \" + lp);\r\n QUnit.assert.equal(rejectedValue_5, null, \"Expected the promise to not be rejected yet - \" + lp);\r\n // This will cause the worker promise to get resolved\r\n clock.tick(1);\r\n QUnit.assert.equal(workerResolved_2[lp], true, \"Worker now resolved\");\r\n }\r\n QUnit.assert.equal(resolvedValue_7, null, \"Expected the promise to not be resolved yet\");\r\n QUnit.assert.equal(rejectedValue_5, null, \"Expected the promise to not be rejected yet\");\r\n // Now lets cause the rejected promise to run\r\n clock.tick(1500);\r\n QUnit.assert.ok(resolvedValue_7 == null, \"Expected the promise to not be resolved\");\r\n QUnit.assert.ok(rejectedValue_5 != null, \"Expected the promise to be rejected\");\r\n QUnit.assert.ok(rejectedValue_5.message.indexOf(\"Simulated Rejection\") != -1, \"Main promise should have rejected with the rejected error\");\r\n }\r\n finally {\r\n clock.restore();\r\n }\r\n }\r\n });\r\n };\r\n return ESPromiseTests;\r\n}(TestClass));\r\nexport { ESPromiseTests };\r\n//# sourceMappingURL=ESPromiseTests.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +0,0 @@
1
- import { TestClass } from './TestClass';
2
- export declare class FileSizeCheckTest extends TestClass {
3
- testInitialize(): void;
4
- registerTests(): void;
5
- }
@@ -1,42 +0,0 @@
1
- /*
2
- * 1DS JS SDK Core, 3.1.3
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
7
- import { TestClass } from './TestClass';
8
- import { ESPromise } from '../src/Index';
9
- import * as pako from 'pako';
10
- var MAX_DEFLATE_SIZE = 30;
11
- var FileSizeCheckTest = /** @class */ (function (_super) {
12
- __extends(FileSizeCheckTest, _super);
13
- function FileSizeCheckTest() {
14
- return _super !== null && _super.apply(this, arguments) || this;
15
- }
16
- FileSizeCheckTest.prototype.testInitialize = function () {
17
- };
18
- FileSizeCheckTest.prototype.registerTests = function () {
19
- this.testCase({
20
- name: "Test ms.core gzip size",
21
- test: function () {
22
- return new ESPromise(function (testCompleted, testFailed) {
23
- var xhr = new XMLHttpRequest();
24
- xhr.open('GET', '../bundle/ms.core-test.min.js', true);
25
- xhr.onload = function () {
26
- var size = Math.ceil(pako.deflate(xhr.responseText).length / 1024);
27
- QUnit.assert.ok(size <= MAX_DEFLATE_SIZE, "exceed " + MAX_DEFLATE_SIZE + " KB, current deflate size is: " + size + " KB");
28
- testCompleted();
29
- };
30
- xhr.send();
31
- xhr.onerror = function (err) {
32
- QUnit.assert.ok(false, "error in getting deflate size: " + err);
33
- testFailed(err);
34
- };
35
- });
36
- }
37
- });
38
- };
39
- return FileSizeCheckTest;
40
- }(TestClass));
41
- export { FileSizeCheckTest };
42
- //# sourceMappingURL=FileSizeCheckTest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileSizeCheckTest.js.map","sources":["FileSizeCheckTest.js"],"sourcesContent":["import { __extends } from \"tslib\";\r\nimport { TestClass } from './TestClass';\r\nimport { ESPromise } from '../src/Index';\r\nimport * as pako from 'pako';\r\nvar MAX_DEFLATE_SIZE = 30;\r\nvar FileSizeCheckTest = /** @class */ (function (_super) {\r\n __extends(FileSizeCheckTest, _super);\r\n function FileSizeCheckTest() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n FileSizeCheckTest.prototype.testInitialize = function () {\r\n };\r\n FileSizeCheckTest.prototype.registerTests = function () {\r\n this.testCase({\r\n name: \"Test ms.core gzip size\",\r\n test: function () {\r\n return new ESPromise(function (testCompleted, testFailed) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open('GET', '../bundle/ms.core-test.min.js', true);\r\n xhr.onload = function () {\r\n var size = Math.ceil(pako.deflate(xhr.responseText).length / 1024);\r\n QUnit.assert.ok(size <= MAX_DEFLATE_SIZE, \"exceed \" + MAX_DEFLATE_SIZE + \" KB, current deflate size is: \" + size + \" KB\");\r\n testCompleted();\r\n };\r\n xhr.send();\r\n xhr.onerror = function (err) {\r\n QUnit.assert.ok(false, \"error in getting deflate size: \" + err);\r\n testFailed(err);\r\n };\r\n });\r\n }\r\n });\r\n };\r\n return FileSizeCheckTest;\r\n}(TestClass));\r\nexport { FileSizeCheckTest };\r\n//# sourceMappingURL=FileSizeCheckTest.js.map"],"names":[],"mappings":";;;;;AAAA,gFAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1 +0,0 @@
1
- export declare function registerTests(): void;
@@ -1,23 +0,0 @@
1
- /*
2
- * 1DS JS SDK Core, 3.1.3
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- * (Microsoft Internal Only)
5
- */
6
- import { CoreTest } from './CoreTest';
7
- import { ESPromiseTests } from './ESPromiseTests';
8
- import { ESPromiseSchedulerTests } from './ESPromiseSchedulerTests';
9
- import { DynamicProtoTests } from './DynamicProtoTests';
10
- import { UtilsTest } from './UtilsTest';
11
- import { ValueSanitizerTests } from './ValueSanitizerTests';
12
- import { FileSizeCheckTest } from './FileSizeCheckTest';
13
- export function registerTests() {
14
- new CoreTest('CoreTest').registerTests();
15
- new ESPromiseTests('ESPromiseTests').registerTests();
16
- new ESPromiseSchedulerTests('ESPromiseSchedulerTests').registerTests();
17
- new DynamicProtoTests('DynamicProtoTests').registerTests();
18
- new UtilsTest('UtilsTest').registerTests();
19
- new ValueSanitizerTests('ValueSanitizerTests').registerTests();
20
- new FileSizeCheckTest('FileSizeCheckTest').registerTests();
21
- }
22
- registerTests();
23
- //# sourceMappingURL=Index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Index.js.map","sources":["Index.js"],"sourcesContent":["import { CoreTest } from './CoreTest';\r\nimport { ESPromiseTests } from './ESPromiseTests';\r\nimport { ESPromiseSchedulerTests } from './ESPromiseSchedulerTests';\r\nimport { DynamicProtoTests } from './DynamicProtoTests';\r\nimport { UtilsTest } from './UtilsTest';\r\nimport { ValueSanitizerTests } from './ValueSanitizerTests';\r\nimport { FileSizeCheckTest } from './FileSizeCheckTest';\r\nexport function registerTests() {\r\n new CoreTest('CoreTest').registerTests();\r\n new ESPromiseTests('ESPromiseTests').registerTests();\r\n new ESPromiseSchedulerTests('ESPromiseSchedulerTests').registerTests();\r\n new DynamicProtoTests('DynamicProtoTests').registerTests();\r\n new UtilsTest('UtilsTest').registerTests();\r\n new ValueSanitizerTests('ValueSanitizerTests').registerTests();\r\n new FileSizeCheckTest('FileSizeCheckTest').registerTests();\r\n}\r\nregisterTests();\r\n//# sourceMappingURL=Index.js.map"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}