@dereekb/util 13.0.0 → 13.0.2
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/fetch/index.cjs.default.js +1 -0
- package/fetch/index.cjs.js +2234 -665
- package/fetch/index.cjs.mjs +2 -0
- package/fetch/index.esm.js +2235 -666
- package/fetch/package.json +13 -18
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +12544 -7968
- package/index.cjs.mjs +2 -0
- package/index.esm.js +12544 -7968
- package/package.json +18 -35
- package/src/lib/object/object.filter.pojo.d.ts +3 -1
- package/test/index.cjs.default.js +1 -0
- package/test/index.cjs.js +1283 -513
- package/test/index.cjs.mjs +2 -0
- package/test/index.esm.js +1283 -513
- package/test/package.json +12 -16
package/test/index.esm.js
CHANGED
|
@@ -1,36 +1,249 @@
|
|
|
1
1
|
import { promiseReference, forwardFunction, mapObjectMap, isPromise, build } from '@dereekb/util';
|
|
2
|
+
import { BaseError } from 'make-error';
|
|
2
3
|
|
|
4
|
+
function _assert_this_initialized$4(self) {
|
|
5
|
+
if (self === void 0) {
|
|
6
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7
|
+
}
|
|
8
|
+
return self;
|
|
9
|
+
}
|
|
10
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
11
|
+
try {
|
|
12
|
+
var info = gen[key](arg);
|
|
13
|
+
var value = info.value;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
reject(error);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (info.done) {
|
|
19
|
+
resolve(value);
|
|
20
|
+
} else {
|
|
21
|
+
Promise.resolve(value).then(_next, _throw);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function _async_to_generator$2(fn) {
|
|
25
|
+
return function() {
|
|
26
|
+
var self = this, args = arguments;
|
|
27
|
+
return new Promise(function(resolve, reject) {
|
|
28
|
+
var gen = fn.apply(self, args);
|
|
29
|
+
function _next(value) {
|
|
30
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
31
|
+
}
|
|
32
|
+
function _throw(err) {
|
|
33
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
34
|
+
}
|
|
35
|
+
_next(undefined);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function _call_super$4(_this, derived, args) {
|
|
40
|
+
derived = _get_prototype_of$4(derived);
|
|
41
|
+
return _possible_constructor_return$4(_this, _is_native_reflect_construct$4() ? Reflect.construct(derived, [], _get_prototype_of$4(_this).constructor) : derived.apply(_this, args));
|
|
42
|
+
}
|
|
43
|
+
function _class_call_check$4(instance, Constructor) {
|
|
44
|
+
if (!(instance instanceof Constructor)) {
|
|
45
|
+
throw new TypeError("Cannot call a class as a function");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _defineProperties(target, props) {
|
|
49
|
+
for(var i = 0; i < props.length; i++){
|
|
50
|
+
var descriptor = props[i];
|
|
51
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
52
|
+
descriptor.configurable = true;
|
|
53
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
54
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
58
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
59
|
+
return Constructor;
|
|
60
|
+
}
|
|
61
|
+
function _define_property$2(obj, key, value) {
|
|
62
|
+
if (key in obj) {
|
|
63
|
+
Object.defineProperty(obj, key, {
|
|
64
|
+
value: value,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
obj[key] = value;
|
|
71
|
+
}
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
74
|
+
function _get_prototype_of$4(o) {
|
|
75
|
+
_get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
76
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
77
|
+
};
|
|
78
|
+
return _get_prototype_of$4(o);
|
|
79
|
+
}
|
|
80
|
+
function _inherits$4(subClass, superClass) {
|
|
81
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
82
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
83
|
+
}
|
|
84
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
85
|
+
constructor: {
|
|
86
|
+
value: subClass,
|
|
87
|
+
writable: true,
|
|
88
|
+
configurable: true
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (superClass) _set_prototype_of$4(subClass, superClass);
|
|
92
|
+
}
|
|
93
|
+
function _possible_constructor_return$4(self, call) {
|
|
94
|
+
if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
|
|
95
|
+
return call;
|
|
96
|
+
}
|
|
97
|
+
return _assert_this_initialized$4(self);
|
|
98
|
+
}
|
|
99
|
+
function _set_prototype_of$4(o, p) {
|
|
100
|
+
_set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
101
|
+
o.__proto__ = p;
|
|
102
|
+
return o;
|
|
103
|
+
};
|
|
104
|
+
return _set_prototype_of$4(o, p);
|
|
105
|
+
}
|
|
106
|
+
function _type_of$4(obj) {
|
|
107
|
+
"@swc/helpers - typeof";
|
|
108
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
109
|
+
}
|
|
110
|
+
function _is_native_reflect_construct$4() {
|
|
111
|
+
try {
|
|
112
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
113
|
+
} catch (_) {}
|
|
114
|
+
return (_is_native_reflect_construct$4 = function() {
|
|
115
|
+
return !!result;
|
|
116
|
+
})();
|
|
117
|
+
}
|
|
118
|
+
function _ts_generator$2(thisArg, body) {
|
|
119
|
+
var f, y, t, _ = {
|
|
120
|
+
label: 0,
|
|
121
|
+
sent: function() {
|
|
122
|
+
if (t[0] & 1) throw t[1];
|
|
123
|
+
return t[1];
|
|
124
|
+
},
|
|
125
|
+
trys: [],
|
|
126
|
+
ops: []
|
|
127
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
128
|
+
return d(g, "next", {
|
|
129
|
+
value: verb(0)
|
|
130
|
+
}), d(g, "throw", {
|
|
131
|
+
value: verb(1)
|
|
132
|
+
}), d(g, "return", {
|
|
133
|
+
value: verb(2)
|
|
134
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
135
|
+
value: function() {
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
}), g;
|
|
139
|
+
function verb(n) {
|
|
140
|
+
return function(v) {
|
|
141
|
+
return step([
|
|
142
|
+
n,
|
|
143
|
+
v
|
|
144
|
+
]);
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function step(op) {
|
|
148
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
149
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
150
|
+
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;
|
|
151
|
+
if (y = 0, t) op = [
|
|
152
|
+
op[0] & 2,
|
|
153
|
+
t.value
|
|
154
|
+
];
|
|
155
|
+
switch(op[0]){
|
|
156
|
+
case 0:
|
|
157
|
+
case 1:
|
|
158
|
+
t = op;
|
|
159
|
+
break;
|
|
160
|
+
case 4:
|
|
161
|
+
_.label++;
|
|
162
|
+
return {
|
|
163
|
+
value: op[1],
|
|
164
|
+
done: false
|
|
165
|
+
};
|
|
166
|
+
case 5:
|
|
167
|
+
_.label++;
|
|
168
|
+
y = op[1];
|
|
169
|
+
op = [
|
|
170
|
+
0
|
|
171
|
+
];
|
|
172
|
+
continue;
|
|
173
|
+
case 7:
|
|
174
|
+
op = _.ops.pop();
|
|
175
|
+
_.trys.pop();
|
|
176
|
+
continue;
|
|
177
|
+
default:
|
|
178
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
179
|
+
_ = 0;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
183
|
+
_.label = op[1];
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
187
|
+
_.label = t[1];
|
|
188
|
+
t = op;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
if (t && _.label < t[2]) {
|
|
192
|
+
_.label = t[2];
|
|
193
|
+
_.ops.push(op);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
if (t[2]) _.ops.pop();
|
|
197
|
+
_.trys.pop();
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
op = body.call(thisArg, _);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
op = [
|
|
203
|
+
6,
|
|
204
|
+
e
|
|
205
|
+
];
|
|
206
|
+
y = 0;
|
|
207
|
+
} finally{
|
|
208
|
+
f = t = 0;
|
|
209
|
+
}
|
|
210
|
+
if (op[0] & 5) throw op[1];
|
|
211
|
+
return {
|
|
212
|
+
value: op[0] ? op[1] : void 0,
|
|
213
|
+
done: true
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
3
217
|
/**
|
|
4
218
|
* Passes the error to the TestDoneCallback.
|
|
5
219
|
* @param done
|
|
6
220
|
* @param e
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
221
|
+
*/ function failWithTestDoneCallback(done) {
|
|
222
|
+
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Error('failed test');
|
|
223
|
+
if (done.fail != null) {
|
|
224
|
+
done.fail(e);
|
|
225
|
+
} else {
|
|
226
|
+
done(e);
|
|
227
|
+
}
|
|
14
228
|
}
|
|
15
229
|
/**
|
|
16
230
|
* Creates a new TestDoneCallbackRef.
|
|
17
231
|
*
|
|
18
232
|
* Used to create a promise reference that can be used to assert that a test function was called.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
233
|
+
*/ function testDoneCallbackRef() {
|
|
234
|
+
var _promise = promiseReference();
|
|
235
|
+
var done = function done(e) {
|
|
236
|
+
if (e) {
|
|
237
|
+
_promise.reject(e);
|
|
238
|
+
} else {
|
|
239
|
+
_promise.resolve();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
done.fail = done;
|
|
243
|
+
return {
|
|
244
|
+
_promise: _promise,
|
|
245
|
+
done: done
|
|
246
|
+
};
|
|
34
247
|
}
|
|
35
248
|
/**
|
|
36
249
|
* Wraps a callback-based test (using done) for Vitest compatibility.
|
|
@@ -51,403 +264,822 @@ function testDoneCallbackRef() {
|
|
|
51
264
|
* // async test code
|
|
52
265
|
* done();
|
|
53
266
|
* }));
|
|
54
|
-
*/
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
267
|
+
*/ function callbackTest(testFn) {
|
|
268
|
+
return function() {
|
|
269
|
+
return _async_to_generator$2(function() {
|
|
270
|
+
var done;
|
|
271
|
+
return _ts_generator$2(this, function(_state) {
|
|
272
|
+
switch(_state.label){
|
|
273
|
+
case 0:
|
|
274
|
+
done = testDoneCallbackRef();
|
|
275
|
+
return [
|
|
276
|
+
4,
|
|
277
|
+
testFn(done.done)
|
|
278
|
+
];
|
|
279
|
+
case 1:
|
|
280
|
+
_state.sent();
|
|
281
|
+
return [
|
|
282
|
+
2,
|
|
283
|
+
done._promise.promise
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
})();
|
|
288
|
+
};
|
|
61
289
|
}
|
|
62
290
|
/**
|
|
63
291
|
* Abstract TestContextFixture instance.
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
292
|
+
*/ var AbstractTestContextFixture = /*#__PURE__*/ function() {
|
|
293
|
+
function AbstractTestContextFixture() {
|
|
294
|
+
_class_call_check$4(this, AbstractTestContextFixture);
|
|
295
|
+
_define_property$2(this, "_instance", void 0);
|
|
296
|
+
}
|
|
297
|
+
_create_class(AbstractTestContextFixture, [
|
|
298
|
+
{
|
|
299
|
+
key: "instance",
|
|
300
|
+
get: function get() {
|
|
301
|
+
return this._instance;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
key: "setInstance",
|
|
306
|
+
value: function setInstance(instance) {
|
|
307
|
+
var _this = this;
|
|
308
|
+
if (this._instance != null) {
|
|
309
|
+
throw new Error("The testing fixture is locked. Don't call setInstance() directly.");
|
|
310
|
+
}
|
|
311
|
+
this._instance = instance;
|
|
312
|
+
return function() {
|
|
313
|
+
delete _this._instance;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
]);
|
|
318
|
+
return AbstractTestContextFixture;
|
|
319
|
+
}();
|
|
82
320
|
/**
|
|
83
321
|
* Abstract TestContextFixture instance with a parent.
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
322
|
+
*/ var AbstractChildTestContextFixture = /*#__PURE__*/ function(AbstractTestContextFixture) {
|
|
323
|
+
_inherits$4(AbstractChildTestContextFixture, AbstractTestContextFixture);
|
|
324
|
+
function AbstractChildTestContextFixture(parent) {
|
|
325
|
+
_class_call_check$4(this, AbstractChildTestContextFixture);
|
|
326
|
+
var _this;
|
|
327
|
+
_this = _call_super$4(this, AbstractChildTestContextFixture), _define_property$2(_this, "parent", void 0);
|
|
328
|
+
_this.parent = parent;
|
|
329
|
+
return _this;
|
|
330
|
+
}
|
|
331
|
+
return AbstractChildTestContextFixture;
|
|
332
|
+
}(AbstractTestContextFixture);
|
|
92
333
|
/**
|
|
93
334
|
* Creates a TestContextBuilderFunction given the input builder.
|
|
94
335
|
*
|
|
95
336
|
* @param builder
|
|
96
337
|
* @returns
|
|
97
|
-
*/
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
338
|
+
*/ function testContextBuilder(builder) {
|
|
339
|
+
return function(inputConfig) {
|
|
340
|
+
var config = builder.buildConfig(inputConfig);
|
|
341
|
+
return function(buildTests) {
|
|
342
|
+
var fixture = builder.buildFixture(config);
|
|
343
|
+
// add before each
|
|
344
|
+
if (builder.beforeEach != null) {
|
|
345
|
+
beforeEach(builder.beforeEach);
|
|
346
|
+
}
|
|
347
|
+
// add tests
|
|
348
|
+
useTestContextFixture({
|
|
349
|
+
fixture: fixture,
|
|
350
|
+
/**
|
|
351
|
+
* Build tests by passing the fixture to the testing functions.
|
|
352
|
+
*
|
|
353
|
+
* This will inject all tests and sub lifecycle items.
|
|
354
|
+
*/ buildTests: buildTests,
|
|
355
|
+
initInstance: function initInstance() {
|
|
356
|
+
return builder.setupInstance(config);
|
|
357
|
+
},
|
|
358
|
+
destroyInstance: function destroyInstance(instance) {
|
|
359
|
+
return builder.teardownInstance(instance, config);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
// add after each
|
|
363
|
+
if (builder.afterEach != null) {
|
|
364
|
+
afterEach(builder.afterEach);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
123
367
|
};
|
|
124
|
-
};
|
|
125
368
|
}
|
|
126
369
|
/**
|
|
127
370
|
* Creates a test context and configurations that will initialize an instance
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
371
|
+
*/ function useTestContextFixture(config) {
|
|
372
|
+
var buildTests = config.buildTests, fixture = config.fixture, initInstance = config.initInstance, destroyInstance = config.destroyInstance;
|
|
373
|
+
var clearInstance;
|
|
374
|
+
var instance;
|
|
375
|
+
// Create an instance
|
|
376
|
+
beforeEach(function() {
|
|
377
|
+
return _async_to_generator$2(function() {
|
|
378
|
+
var e;
|
|
379
|
+
return _ts_generator$2(this, function(_state) {
|
|
380
|
+
switch(_state.label){
|
|
381
|
+
case 0:
|
|
382
|
+
_state.trys.push([
|
|
383
|
+
0,
|
|
384
|
+
2,
|
|
385
|
+
,
|
|
386
|
+
3
|
|
387
|
+
]);
|
|
388
|
+
return [
|
|
389
|
+
4,
|
|
390
|
+
initInstance()
|
|
391
|
+
];
|
|
392
|
+
case 1:
|
|
393
|
+
instance = _state.sent();
|
|
394
|
+
clearInstance = fixture.setInstance(instance);
|
|
395
|
+
return [
|
|
396
|
+
3,
|
|
397
|
+
3
|
|
398
|
+
];
|
|
399
|
+
case 2:
|
|
400
|
+
e = _state.sent();
|
|
401
|
+
console.error('Failed building a test instance due to an error in buildInstance(). Error: ', e);
|
|
402
|
+
if (clearInstance) {
|
|
403
|
+
clearInstance();
|
|
404
|
+
}
|
|
405
|
+
throw e;
|
|
406
|
+
case 3:
|
|
407
|
+
return [
|
|
408
|
+
2
|
|
409
|
+
];
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
})();
|
|
413
|
+
});
|
|
414
|
+
// Declare tests
|
|
415
|
+
buildTests(fixture);
|
|
416
|
+
// Cleanup
|
|
417
|
+
afterEach(function() {
|
|
418
|
+
return _async_to_generator$2(function() {
|
|
419
|
+
var e;
|
|
420
|
+
return _ts_generator$2(this, function(_state) {
|
|
421
|
+
switch(_state.label){
|
|
422
|
+
case 0:
|
|
423
|
+
if (clearInstance) {
|
|
424
|
+
clearInstance();
|
|
425
|
+
}
|
|
426
|
+
if (fixture.instance != null) {
|
|
427
|
+
console.warn('Expected instance to be set on fixture for cleanup but was set to something else.');
|
|
428
|
+
}
|
|
429
|
+
if (!destroyInstance) return [
|
|
430
|
+
3,
|
|
431
|
+
4
|
|
432
|
+
];
|
|
433
|
+
_state.label = 1;
|
|
434
|
+
case 1:
|
|
435
|
+
_state.trys.push([
|
|
436
|
+
1,
|
|
437
|
+
3,
|
|
438
|
+
,
|
|
439
|
+
4
|
|
440
|
+
]);
|
|
441
|
+
return [
|
|
442
|
+
4,
|
|
443
|
+
destroyInstance(instance)
|
|
444
|
+
];
|
|
445
|
+
case 2:
|
|
446
|
+
_state.sent();
|
|
447
|
+
instance = undefined;
|
|
448
|
+
return [
|
|
449
|
+
3,
|
|
450
|
+
4
|
|
451
|
+
];
|
|
452
|
+
case 3:
|
|
453
|
+
e = _state.sent();
|
|
454
|
+
console.error('Failed due to error in destroyInstance()');
|
|
455
|
+
throw e;
|
|
456
|
+
case 4:
|
|
457
|
+
return [
|
|
458
|
+
2
|
|
459
|
+
];
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
})();
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function _assert_this_initialized$3(self) {
|
|
467
|
+
if (self === void 0) {
|
|
468
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
469
|
+
}
|
|
470
|
+
return self;
|
|
471
|
+
}
|
|
472
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
140
473
|
try {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
} catch (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Declare tests
|
|
152
|
-
buildTests(fixture);
|
|
153
|
-
// Cleanup
|
|
154
|
-
afterEach(async () => {
|
|
155
|
-
if (clearInstance) {
|
|
156
|
-
clearInstance();
|
|
157
|
-
}
|
|
158
|
-
if (fixture.instance != null) {
|
|
159
|
-
console.warn('Expected instance to be set on fixture for cleanup but was set to something else.');
|
|
160
|
-
}
|
|
161
|
-
if (destroyInstance) {
|
|
162
|
-
try {
|
|
163
|
-
await destroyInstance(instance);
|
|
164
|
-
instance = undefined;
|
|
165
|
-
} catch (e) {
|
|
166
|
-
console.error('Failed due to error in destroyInstance()');
|
|
167
|
-
throw e;
|
|
168
|
-
}
|
|
474
|
+
var info = gen[key](arg);
|
|
475
|
+
var value = info.value;
|
|
476
|
+
} catch (error) {
|
|
477
|
+
reject(error);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (info.done) {
|
|
481
|
+
resolve(value);
|
|
482
|
+
} else {
|
|
483
|
+
Promise.resolve(value).then(_next, _throw);
|
|
169
484
|
}
|
|
170
|
-
});
|
|
171
485
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
486
|
+
function _async_to_generator$1(fn) {
|
|
487
|
+
return function() {
|
|
488
|
+
var self = this, args = arguments;
|
|
489
|
+
return new Promise(function(resolve, reject) {
|
|
490
|
+
var gen = fn.apply(self, args);
|
|
491
|
+
function _next(value) {
|
|
492
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
493
|
+
}
|
|
494
|
+
function _throw(err) {
|
|
495
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
496
|
+
}
|
|
497
|
+
_next(undefined);
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function _call_super$3(_this, derived, args) {
|
|
502
|
+
derived = _get_prototype_of$3(derived);
|
|
503
|
+
return _possible_constructor_return$3(_this, _is_native_reflect_construct$3() ? Reflect.construct(derived, [], _get_prototype_of$3(_this).constructor) : derived.apply(_this, args));
|
|
504
|
+
}
|
|
505
|
+
function _class_call_check$3(instance, Constructor) {
|
|
506
|
+
if (!(instance instanceof Constructor)) {
|
|
507
|
+
throw new TypeError("Cannot call a class as a function");
|
|
508
|
+
}
|
|
178
509
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
510
|
+
function _define_property$1(obj, key, value) {
|
|
511
|
+
if (key in obj) {
|
|
512
|
+
Object.defineProperty(obj, key, {
|
|
513
|
+
value: value,
|
|
514
|
+
enumerable: true,
|
|
515
|
+
configurable: true,
|
|
516
|
+
writable: true
|
|
517
|
+
});
|
|
518
|
+
} else {
|
|
519
|
+
obj[key] = value;
|
|
520
|
+
}
|
|
521
|
+
return obj;
|
|
522
|
+
}
|
|
523
|
+
function _get_prototype_of$3(o) {
|
|
524
|
+
_get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
525
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
526
|
+
};
|
|
527
|
+
return _get_prototype_of$3(o);
|
|
185
528
|
}
|
|
529
|
+
function _inherits$3(subClass, superClass) {
|
|
530
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
531
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
532
|
+
}
|
|
533
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
534
|
+
constructor: {
|
|
535
|
+
value: subClass,
|
|
536
|
+
writable: true,
|
|
537
|
+
configurable: true
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
if (superClass) _set_prototype_of$3(subClass, superClass);
|
|
541
|
+
}
|
|
542
|
+
function _possible_constructor_return$3(self, call) {
|
|
543
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
544
|
+
return call;
|
|
545
|
+
}
|
|
546
|
+
return _assert_this_initialized$3(self);
|
|
547
|
+
}
|
|
548
|
+
function _set_prototype_of$3(o, p) {
|
|
549
|
+
_set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
550
|
+
o.__proto__ = p;
|
|
551
|
+
return o;
|
|
552
|
+
};
|
|
553
|
+
return _set_prototype_of$3(o, p);
|
|
554
|
+
}
|
|
555
|
+
function _type_of$3(obj) {
|
|
556
|
+
"@swc/helpers - typeof";
|
|
557
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
558
|
+
}
|
|
559
|
+
function _is_native_reflect_construct$3() {
|
|
560
|
+
try {
|
|
561
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
562
|
+
} catch (_) {}
|
|
563
|
+
return (_is_native_reflect_construct$3 = function() {
|
|
564
|
+
return !!result;
|
|
565
|
+
})();
|
|
566
|
+
}
|
|
567
|
+
function _ts_generator$1(thisArg, body) {
|
|
568
|
+
var f, y, t, _ = {
|
|
569
|
+
label: 0,
|
|
570
|
+
sent: function() {
|
|
571
|
+
if (t[0] & 1) throw t[1];
|
|
572
|
+
return t[1];
|
|
573
|
+
},
|
|
574
|
+
trys: [],
|
|
575
|
+
ops: []
|
|
576
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
577
|
+
return d(g, "next", {
|
|
578
|
+
value: verb(0)
|
|
579
|
+
}), d(g, "throw", {
|
|
580
|
+
value: verb(1)
|
|
581
|
+
}), d(g, "return", {
|
|
582
|
+
value: verb(2)
|
|
583
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
584
|
+
value: function() {
|
|
585
|
+
return this;
|
|
586
|
+
}
|
|
587
|
+
}), g;
|
|
588
|
+
function verb(n) {
|
|
589
|
+
return function(v) {
|
|
590
|
+
return step([
|
|
591
|
+
n,
|
|
592
|
+
v
|
|
593
|
+
]);
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function step(op) {
|
|
597
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
598
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
599
|
+
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;
|
|
600
|
+
if (y = 0, t) op = [
|
|
601
|
+
op[0] & 2,
|
|
602
|
+
t.value
|
|
603
|
+
];
|
|
604
|
+
switch(op[0]){
|
|
605
|
+
case 0:
|
|
606
|
+
case 1:
|
|
607
|
+
t = op;
|
|
608
|
+
break;
|
|
609
|
+
case 4:
|
|
610
|
+
_.label++;
|
|
611
|
+
return {
|
|
612
|
+
value: op[1],
|
|
613
|
+
done: false
|
|
614
|
+
};
|
|
615
|
+
case 5:
|
|
616
|
+
_.label++;
|
|
617
|
+
y = op[1];
|
|
618
|
+
op = [
|
|
619
|
+
0
|
|
620
|
+
];
|
|
621
|
+
continue;
|
|
622
|
+
case 7:
|
|
623
|
+
op = _.ops.pop();
|
|
624
|
+
_.trys.pop();
|
|
625
|
+
continue;
|
|
626
|
+
default:
|
|
627
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
628
|
+
_ = 0;
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
632
|
+
_.label = op[1];
|
|
633
|
+
break;
|
|
634
|
+
}
|
|
635
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
636
|
+
_.label = t[1];
|
|
637
|
+
t = op;
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
if (t && _.label < t[2]) {
|
|
641
|
+
_.label = t[2];
|
|
642
|
+
_.ops.push(op);
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
if (t[2]) _.ops.pop();
|
|
646
|
+
_.trys.pop();
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
op = body.call(thisArg, _);
|
|
650
|
+
} catch (e) {
|
|
651
|
+
op = [
|
|
652
|
+
6,
|
|
653
|
+
e
|
|
654
|
+
];
|
|
655
|
+
y = 0;
|
|
656
|
+
} finally{
|
|
657
|
+
f = t = 0;
|
|
658
|
+
}
|
|
659
|
+
if (op[0] & 5) throw op[1];
|
|
660
|
+
return {
|
|
661
|
+
value: op[0] ? op[1] : void 0,
|
|
662
|
+
done: true
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
var AbstractWrappedFixture = function AbstractWrappedFixture(fixture) {
|
|
667
|
+
_class_call_check$3(this, AbstractWrappedFixture);
|
|
668
|
+
_define_property$1(this, "fixture", void 0);
|
|
669
|
+
this.fixture = fixture;
|
|
670
|
+
};
|
|
671
|
+
var AbstractWrappedFixtureWithInstance = /*#__PURE__*/ function(AbstractTestContextFixture) {
|
|
672
|
+
_inherits$3(AbstractWrappedFixtureWithInstance, AbstractTestContextFixture);
|
|
673
|
+
function AbstractWrappedFixtureWithInstance(parent) {
|
|
674
|
+
_class_call_check$3(this, AbstractWrappedFixtureWithInstance);
|
|
675
|
+
var _this;
|
|
676
|
+
_this = _call_super$3(this, AbstractWrappedFixtureWithInstance), _define_property$1(_this, "parent", void 0);
|
|
677
|
+
_this.parent = parent;
|
|
678
|
+
return _this;
|
|
679
|
+
}
|
|
680
|
+
return AbstractWrappedFixtureWithInstance;
|
|
681
|
+
}(AbstractTestContextFixture);
|
|
186
682
|
/**
|
|
187
683
|
* Wraps the input TestContextFactory to emit another type of Fixture for tests.
|
|
188
684
|
*
|
|
189
685
|
* @returns
|
|
190
|
-
*/
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
686
|
+
*/ function wrapTestContextFactory(config) {
|
|
687
|
+
return function(factory) {
|
|
688
|
+
return function(buildTests) {
|
|
689
|
+
factory(function(inputFixture) {
|
|
690
|
+
var wrap = config.wrapFixture(inputFixture);
|
|
691
|
+
var effect;
|
|
692
|
+
// add before each
|
|
693
|
+
if (config.setupWrap != null) {
|
|
694
|
+
beforeEach(function() {
|
|
695
|
+
return _async_to_generator$1(function() {
|
|
696
|
+
return _ts_generator$1(this, function(_state) {
|
|
697
|
+
switch(_state.label){
|
|
698
|
+
case 0:
|
|
699
|
+
return [
|
|
700
|
+
4,
|
|
701
|
+
config.setupWrap(wrap)
|
|
702
|
+
];
|
|
703
|
+
case 1:
|
|
704
|
+
effect = _state.sent();
|
|
705
|
+
return [
|
|
706
|
+
2
|
|
707
|
+
];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
})();
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
// add tests
|
|
714
|
+
buildTests(wrap);
|
|
715
|
+
// add after each
|
|
716
|
+
if (config.teardownWrap != null) {
|
|
717
|
+
afterEach(function() {
|
|
718
|
+
return _async_to_generator$1(function() {
|
|
719
|
+
return _ts_generator$1(this, function(_state) {
|
|
720
|
+
switch(_state.label){
|
|
721
|
+
case 0:
|
|
722
|
+
return [
|
|
723
|
+
4,
|
|
724
|
+
config.teardownWrap(wrap, effect)
|
|
725
|
+
];
|
|
726
|
+
case 1:
|
|
727
|
+
_state.sent();
|
|
728
|
+
return [
|
|
729
|
+
2
|
|
730
|
+
];
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
})();
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
};
|
|
212
738
|
};
|
|
213
|
-
};
|
|
214
739
|
}
|
|
215
740
|
function instanceWrapTestContextFactory(config) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
741
|
+
return wrapTestContextFactory({
|
|
742
|
+
wrapFixture: config.wrapFixture,
|
|
743
|
+
setupWrap: function setupWrap(wrap) {
|
|
744
|
+
return _async_to_generator$1(function() {
|
|
745
|
+
var instance, effect;
|
|
746
|
+
return _ts_generator$1(this, function(_state) {
|
|
747
|
+
switch(_state.label){
|
|
748
|
+
case 0:
|
|
749
|
+
return [
|
|
750
|
+
4,
|
|
751
|
+
config.makeInstance(wrap)
|
|
752
|
+
];
|
|
753
|
+
case 1:
|
|
754
|
+
instance = _state.sent();
|
|
755
|
+
effect = wrap.setInstance(instance);
|
|
756
|
+
if (!config.setupInstance) return [
|
|
757
|
+
3,
|
|
758
|
+
3
|
|
759
|
+
];
|
|
760
|
+
return [
|
|
761
|
+
4,
|
|
762
|
+
config.setupInstance(instance, wrap)
|
|
763
|
+
];
|
|
764
|
+
case 2:
|
|
765
|
+
_state.sent();
|
|
766
|
+
_state.label = 3;
|
|
767
|
+
case 3:
|
|
768
|
+
return [
|
|
769
|
+
2,
|
|
770
|
+
effect
|
|
771
|
+
];
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
})();
|
|
775
|
+
},
|
|
776
|
+
teardownWrap: function teardownWrap(wrap, deleteInstanceEffect) {
|
|
777
|
+
return _async_to_generator$1(function() {
|
|
778
|
+
return _ts_generator$1(this, function(_state) {
|
|
779
|
+
switch(_state.label){
|
|
780
|
+
case 0:
|
|
781
|
+
deleteInstanceEffect === null || deleteInstanceEffect === void 0 ? void 0 : deleteInstanceEffect();
|
|
782
|
+
if (!config.teardownInstance) return [
|
|
783
|
+
3,
|
|
784
|
+
2
|
|
785
|
+
];
|
|
786
|
+
return [
|
|
787
|
+
4,
|
|
788
|
+
config.teardownInstance(wrap.instance)
|
|
789
|
+
];
|
|
790
|
+
case 1:
|
|
791
|
+
_state.sent();
|
|
792
|
+
_state.label = 2;
|
|
793
|
+
case 2:
|
|
794
|
+
return [
|
|
795
|
+
2
|
|
796
|
+
];
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
})();
|
|
800
|
+
}
|
|
801
|
+
});
|
|
233
802
|
}
|
|
234
803
|
|
|
235
804
|
/**
|
|
236
805
|
* Creates a test context and configurations that provides a function to build tests based on the configuration.
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
} = config;
|
|
242
|
-
const forward = forwardFunction(fn);
|
|
243
|
-
buildTests(forward);
|
|
806
|
+
*/ function useTestFunctionFixture(config, buildTests) {
|
|
807
|
+
var fn = config.fn;
|
|
808
|
+
var forward = forwardFunction(fn);
|
|
809
|
+
buildTests(forward);
|
|
244
810
|
}
|
|
245
811
|
/**
|
|
246
812
|
* Creates a test context and configurations that provides a function to build tests based on the configuration.
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
813
|
+
*/ function useTestFunctionMapFixture(config, buildTests) {
|
|
814
|
+
var forwardedFunctions = mapObjectMap(config.fns, function(fn) {
|
|
815
|
+
return forwardFunction(fn);
|
|
816
|
+
});
|
|
817
|
+
buildTests(forwardedFunctions);
|
|
251
818
|
}
|
|
252
819
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
820
|
+
function _assert_this_initialized$2(self) {
|
|
821
|
+
if (self === void 0) {
|
|
822
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
823
|
+
}
|
|
824
|
+
return self;
|
|
825
|
+
}
|
|
826
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
827
|
+
try {
|
|
828
|
+
var info = gen[key](arg);
|
|
829
|
+
var value = info.value;
|
|
830
|
+
} catch (error) {
|
|
831
|
+
reject(error);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
if (info.done) {
|
|
835
|
+
resolve(value);
|
|
836
|
+
} else {
|
|
837
|
+
Promise.resolve(value).then(_next, _throw);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
function _async_to_generator(fn) {
|
|
841
|
+
return function() {
|
|
842
|
+
var self = this, args = arguments;
|
|
843
|
+
return new Promise(function(resolve, reject) {
|
|
844
|
+
var gen = fn.apply(self, args);
|
|
845
|
+
function _next(value) {
|
|
846
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
847
|
+
}
|
|
848
|
+
function _throw(err) {
|
|
849
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
850
|
+
}
|
|
851
|
+
_next(undefined);
|
|
852
|
+
});
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function _call_super$2(_this, derived, args) {
|
|
856
|
+
derived = _get_prototype_of$2(derived);
|
|
857
|
+
return _possible_constructor_return$2(_this, _is_native_reflect_construct$2() ? Reflect.construct(derived, args || [], _get_prototype_of$2(_this).constructor) : derived.apply(_this, args));
|
|
858
|
+
}
|
|
859
|
+
function _class_call_check$2(instance, Constructor) {
|
|
860
|
+
if (!(instance instanceof Constructor)) {
|
|
861
|
+
throw new TypeError("Cannot call a class as a function");
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function _define_property(obj, key, value) {
|
|
865
|
+
if (key in obj) {
|
|
866
|
+
Object.defineProperty(obj, key, {
|
|
867
|
+
value: value,
|
|
868
|
+
enumerable: true,
|
|
869
|
+
configurable: true,
|
|
870
|
+
writable: true
|
|
871
|
+
});
|
|
872
|
+
} else {
|
|
873
|
+
obj[key] = value;
|
|
874
|
+
}
|
|
875
|
+
return obj;
|
|
876
|
+
}
|
|
877
|
+
function _get_prototype_of$2(o) {
|
|
878
|
+
_get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
879
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
880
|
+
};
|
|
881
|
+
return _get_prototype_of$2(o);
|
|
882
|
+
}
|
|
883
|
+
function _inherits$2(subClass, superClass) {
|
|
884
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
885
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
886
|
+
}
|
|
887
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
888
|
+
constructor: {
|
|
889
|
+
value: subClass,
|
|
890
|
+
writable: true,
|
|
891
|
+
configurable: true
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
if (superClass) _set_prototype_of$2(subClass, superClass);
|
|
895
|
+
}
|
|
896
|
+
function _instanceof(left, right) {
|
|
897
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
898
|
+
return !!right[Symbol.hasInstance](left);
|
|
899
|
+
} else {
|
|
900
|
+
return left instanceof right;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function _possible_constructor_return$2(self, call) {
|
|
904
|
+
if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
|
|
905
|
+
return call;
|
|
906
|
+
}
|
|
907
|
+
return _assert_this_initialized$2(self);
|
|
908
|
+
}
|
|
909
|
+
function _set_prototype_of$2(o, p) {
|
|
910
|
+
_set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
911
|
+
o.__proto__ = p;
|
|
912
|
+
return o;
|
|
913
|
+
};
|
|
914
|
+
return _set_prototype_of$2(o, p);
|
|
915
|
+
}
|
|
916
|
+
function _type_of$2(obj) {
|
|
917
|
+
"@swc/helpers - typeof";
|
|
918
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
919
|
+
}
|
|
920
|
+
function _is_native_reflect_construct$2() {
|
|
921
|
+
try {
|
|
922
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
923
|
+
} catch (_) {}
|
|
924
|
+
return (_is_native_reflect_construct$2 = function() {
|
|
925
|
+
return !!result;
|
|
926
|
+
})();
|
|
927
|
+
}
|
|
928
|
+
function _ts_generator(thisArg, body) {
|
|
929
|
+
var f, y, t, _ = {
|
|
930
|
+
label: 0,
|
|
931
|
+
sent: function() {
|
|
932
|
+
if (t[0] & 1) throw t[1];
|
|
933
|
+
return t[1];
|
|
934
|
+
},
|
|
935
|
+
trys: [],
|
|
936
|
+
ops: []
|
|
937
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
938
|
+
return d(g, "next", {
|
|
939
|
+
value: verb(0)
|
|
940
|
+
}), d(g, "throw", {
|
|
941
|
+
value: verb(1)
|
|
942
|
+
}), d(g, "return", {
|
|
943
|
+
value: verb(2)
|
|
944
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
945
|
+
value: function() {
|
|
946
|
+
return this;
|
|
947
|
+
}
|
|
948
|
+
}), g;
|
|
949
|
+
function verb(n) {
|
|
950
|
+
return function(v) {
|
|
951
|
+
return step([
|
|
952
|
+
n,
|
|
953
|
+
v
|
|
954
|
+
]);
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
function step(op) {
|
|
958
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
959
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
960
|
+
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;
|
|
961
|
+
if (y = 0, t) op = [
|
|
962
|
+
op[0] & 2,
|
|
963
|
+
t.value
|
|
964
|
+
];
|
|
965
|
+
switch(op[0]){
|
|
966
|
+
case 0:
|
|
967
|
+
case 1:
|
|
968
|
+
t = op;
|
|
969
|
+
break;
|
|
970
|
+
case 4:
|
|
971
|
+
_.label++;
|
|
972
|
+
return {
|
|
973
|
+
value: op[1],
|
|
974
|
+
done: false
|
|
975
|
+
};
|
|
976
|
+
case 5:
|
|
977
|
+
_.label++;
|
|
978
|
+
y = op[1];
|
|
979
|
+
op = [
|
|
980
|
+
0
|
|
981
|
+
];
|
|
982
|
+
continue;
|
|
983
|
+
case 7:
|
|
984
|
+
op = _.ops.pop();
|
|
985
|
+
_.trys.pop();
|
|
986
|
+
continue;
|
|
987
|
+
default:
|
|
988
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
989
|
+
_ = 0;
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
993
|
+
_.label = op[1];
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
997
|
+
_.label = t[1];
|
|
998
|
+
t = op;
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
if (t && _.label < t[2]) {
|
|
1002
|
+
_.label = t[2];
|
|
1003
|
+
_.ops.push(op);
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
if (t[2]) _.ops.pop();
|
|
1007
|
+
_.trys.pop();
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
op = body.call(thisArg, _);
|
|
1011
|
+
} catch (e) {
|
|
1012
|
+
op = [
|
|
1013
|
+
6,
|
|
1014
|
+
e
|
|
1015
|
+
];
|
|
1016
|
+
y = 0;
|
|
1017
|
+
} finally{
|
|
1018
|
+
f = t = 0;
|
|
1019
|
+
}
|
|
1020
|
+
if (op[0] & 5) throw op[1];
|
|
1021
|
+
return {
|
|
1022
|
+
value: op[0] ? op[1] : void 0,
|
|
1023
|
+
done: true
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
411
1027
|
// MARK: Errors
|
|
412
1028
|
/**
|
|
413
1029
|
* Error thrown by fail() and used by expectError()
|
|
414
|
-
*/
|
|
415
|
-
|
|
1030
|
+
*/ var ExpectedFailError = /*#__PURE__*/ function(BaseError) {
|
|
1031
|
+
_inherits$2(ExpectedFailError, BaseError);
|
|
1032
|
+
function ExpectedFailError() {
|
|
1033
|
+
_class_call_check$2(this, ExpectedFailError);
|
|
1034
|
+
return _call_super$2(this, ExpectedFailError, arguments);
|
|
1035
|
+
}
|
|
1036
|
+
return ExpectedFailError;
|
|
1037
|
+
}(BaseError);
|
|
416
1038
|
function failSuccessfullyError(message) {
|
|
417
|
-
|
|
1039
|
+
return new ExpectedFailError(message);
|
|
418
1040
|
}
|
|
419
1041
|
function failSuccessfully(message) {
|
|
420
|
-
|
|
1042
|
+
throw failSuccessfullyError(message);
|
|
421
1043
|
}
|
|
422
1044
|
/**
|
|
423
1045
|
* Error thrown when success occurs when it should not have.
|
|
424
|
-
*/
|
|
425
|
-
|
|
1046
|
+
*/ var UnexpectedSuccessFailureError = /*#__PURE__*/ function(BaseError) {
|
|
1047
|
+
_inherits$2(UnexpectedSuccessFailureError, BaseError);
|
|
1048
|
+
function UnexpectedSuccessFailureError() {
|
|
1049
|
+
_class_call_check$2(this, UnexpectedSuccessFailureError);
|
|
1050
|
+
return _call_super$2(this, UnexpectedSuccessFailureError, arguments);
|
|
1051
|
+
}
|
|
1052
|
+
return UnexpectedSuccessFailureError;
|
|
1053
|
+
}(BaseError);
|
|
426
1054
|
function failDueToSuccessError(message) {
|
|
427
|
-
|
|
1055
|
+
return new UnexpectedSuccessFailureError(message !== null && message !== void 0 ? message : 'expected an error to occur but was successful instead');
|
|
428
1056
|
}
|
|
429
1057
|
/**
|
|
430
1058
|
* Error thrown when the error type was different than the expected type.
|
|
431
|
-
*/
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
1059
|
+
*/ var ExpectedErrorOfSpecificTypeError = /*#__PURE__*/ function(BaseError) {
|
|
1060
|
+
_inherits$2(ExpectedErrorOfSpecificTypeError, BaseError);
|
|
1061
|
+
function ExpectedErrorOfSpecificTypeError(encounteredType, expectedType) {
|
|
1062
|
+
_class_call_check$2(this, ExpectedErrorOfSpecificTypeError);
|
|
1063
|
+
var _this;
|
|
1064
|
+
_this = _call_super$2(this, ExpectedErrorOfSpecificTypeError, [
|
|
1065
|
+
"The error encountered was not of the expected type. Expected: ".concat(expectedType !== null && expectedType !== void 0 ? expectedType : 'n/a', ", but encountered: ").concat(encounteredType, " ")
|
|
1066
|
+
]), _define_property(_this, "encounteredType", void 0), _define_property(_this, "expectedType", void 0);
|
|
1067
|
+
_this.encounteredType = encounteredType;
|
|
1068
|
+
_this.expectedType = expectedType;
|
|
1069
|
+
return _this;
|
|
1070
|
+
}
|
|
1071
|
+
return ExpectedErrorOfSpecificTypeError;
|
|
1072
|
+
}(BaseError);
|
|
441
1073
|
function failTest(message) {
|
|
442
|
-
|
|
1074
|
+
throw failDueToSuccessError(message);
|
|
443
1075
|
}
|
|
444
1076
|
function failDueToSuccess() {
|
|
445
|
-
|
|
1077
|
+
throw failDueToSuccessError();
|
|
446
1078
|
}
|
|
447
1079
|
function EXPECT_ERROR_DEFAULT_HANDLER(e) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
1080
|
+
if (_instanceof(e, ExpectedFailError)) ; else {
|
|
1081
|
+
throw e;
|
|
1082
|
+
}
|
|
451
1083
|
}
|
|
452
1084
|
/**
|
|
453
1085
|
* Creates an ExpectFailAssertionFunction that asserts the encountered error is of the expected type using the instanceof keyword.
|
|
@@ -456,48 +1088,48 @@ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
|
|
|
456
1088
|
*
|
|
457
1089
|
* @param expectedType
|
|
458
1090
|
* @returns
|
|
459
|
-
*/
|
|
460
|
-
function
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
};
|
|
1091
|
+
*/ function expectFailAssertErrorType(expectedType) {
|
|
1092
|
+
return function(error) {
|
|
1093
|
+
if (!_instanceof(error, expectedType)) {
|
|
1094
|
+
throw new ExpectedErrorOfSpecificTypeError(error, expectedType);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
466
1097
|
}
|
|
467
1098
|
function expectFail(errorFn, assertFailType) {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
1099
|
+
function handleError(e) {
|
|
1100
|
+
if (_instanceof(e, UnexpectedSuccessFailureError)) {
|
|
1101
|
+
throw e;
|
|
1102
|
+
} else {
|
|
1103
|
+
var assertionResult = assertFailType === null || assertFailType === void 0 ? void 0 : assertFailType(e);
|
|
1104
|
+
if (assertionResult === false) {
|
|
1105
|
+
throw new ExpectedErrorOfSpecificTypeError(e);
|
|
1106
|
+
}
|
|
1107
|
+
failSuccessfully();
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
try {
|
|
1111
|
+
var result = errorFn();
|
|
1112
|
+
if (isPromise(result)) {
|
|
1113
|
+
return result.then(failDueToSuccess).catch(handleError);
|
|
1114
|
+
} else {
|
|
1115
|
+
failDueToSuccess();
|
|
1116
|
+
}
|
|
1117
|
+
} catch (e) {
|
|
1118
|
+
handleError(e);
|
|
485
1119
|
}
|
|
486
|
-
} catch (e) {
|
|
487
|
-
handleError(e);
|
|
488
|
-
}
|
|
489
1120
|
}
|
|
490
|
-
function expectSuccessfulFail(errorFn
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
1121
|
+
function expectSuccessfulFail(errorFn) {
|
|
1122
|
+
var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
|
|
1123
|
+
try {
|
|
1124
|
+
var result = errorFn();
|
|
1125
|
+
if (isPromise(result)) {
|
|
1126
|
+
return result.then(failDueToSuccess).catch(handleError);
|
|
1127
|
+
} else {
|
|
1128
|
+
failDueToSuccess();
|
|
1129
|
+
}
|
|
1130
|
+
} catch (e) {
|
|
1131
|
+
handleError(e);
|
|
497
1132
|
}
|
|
498
|
-
} catch (e) {
|
|
499
|
-
handleError(e);
|
|
500
|
-
}
|
|
501
1133
|
}
|
|
502
1134
|
/**
|
|
503
1135
|
* Used to wrap a testing function and watch for ExpectedFailError errors in order to pass the test. Other exceptions are treated normally as failures.
|
|
@@ -507,158 +1139,296 @@ function expectSuccessfulFail(errorFn, handleError = EXPECT_ERROR_DEFAULT_HANDLE
|
|
|
507
1139
|
* @param fn
|
|
508
1140
|
* @param strict
|
|
509
1141
|
* @returns
|
|
510
|
-
*/
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
} else {
|
|
523
|
-
done();
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
const result = expectSuccessfulFail(() => {
|
|
528
|
-
let result;
|
|
529
|
-
if (usesDoneCallback) {
|
|
530
|
-
const fakeDone = build({
|
|
531
|
-
base: fakeDoneHandler(),
|
|
532
|
-
build: x => {
|
|
533
|
-
x.failSuccessfully = () => {
|
|
534
|
-
fakeDone(failSuccessfullyError());
|
|
535
|
-
};
|
|
1142
|
+
*/ function shouldFail(fn) {
|
|
1143
|
+
var usesDoneCallback = fn.length > 0;
|
|
1144
|
+
// Return a function that checks arguments at runtime to avoid done callback deprecation warning
|
|
1145
|
+
return function() {
|
|
1146
|
+
return _async_to_generator(function() {
|
|
1147
|
+
var _testDoneCallbackRef, done, _promise, result;
|
|
1148
|
+
function handleError(e) {
|
|
1149
|
+
if (!_instanceof(e, ExpectedFailError)) {
|
|
1150
|
+
failWithTestDoneCallback(done, e);
|
|
1151
|
+
} else {
|
|
1152
|
+
done();
|
|
1153
|
+
}
|
|
536
1154
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
1155
|
+
return _ts_generator(this, function(_state) {
|
|
1156
|
+
_testDoneCallbackRef = testDoneCallbackRef(), done = _testDoneCallbackRef.done, _promise = _testDoneCallbackRef._promise;
|
|
1157
|
+
try {
|
|
1158
|
+
result = expectSuccessfulFail(function() {
|
|
1159
|
+
var result;
|
|
1160
|
+
if (usesDoneCallback) {
|
|
1161
|
+
var fakeDone = build({
|
|
1162
|
+
base: fakeDoneHandler(),
|
|
1163
|
+
build: function build(x) {
|
|
1164
|
+
x.failSuccessfully = function() {
|
|
1165
|
+
fakeDone(failSuccessfullyError());
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
var callbackWithDoneResult = fn(fakeDone);
|
|
1170
|
+
if (isPromise(callbackWithDoneResult)) {
|
|
1171
|
+
fakeDone.reject(new Error('Configured to use "done" value while returning a promise. Configure your test to use one or the other.'));
|
|
1172
|
+
}
|
|
1173
|
+
// return the fake done promise. Done/fail will resolve as a promise.
|
|
1174
|
+
result = fakeDone._ref.promise;
|
|
1175
|
+
} else {
|
|
1176
|
+
result = fn();
|
|
1177
|
+
}
|
|
1178
|
+
return result;
|
|
1179
|
+
}, handleError);
|
|
1180
|
+
// If expectSuccessfulFail returns a promise, handle it
|
|
1181
|
+
if (isPromise(result)) {
|
|
1182
|
+
result.catch(handleError);
|
|
1183
|
+
}
|
|
1184
|
+
} catch (e) {
|
|
1185
|
+
// Handle synchronous errors
|
|
1186
|
+
handleError(e);
|
|
1187
|
+
}
|
|
1188
|
+
return [
|
|
1189
|
+
2,
|
|
1190
|
+
_promise.promise
|
|
1191
|
+
];
|
|
1192
|
+
});
|
|
1193
|
+
})();
|
|
1194
|
+
};
|
|
559
1195
|
}
|
|
560
1196
|
function itShouldFail(describeOrFn, fn) {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
1197
|
+
var description;
|
|
1198
|
+
if (typeof describeOrFn === 'string') {
|
|
1199
|
+
description = "should fail ".concat(describeOrFn);
|
|
1200
|
+
} else {
|
|
1201
|
+
fn = describeOrFn;
|
|
1202
|
+
description = 'should fail';
|
|
1203
|
+
}
|
|
1204
|
+
it(description, shouldFail(fn));
|
|
569
1205
|
}
|
|
570
1206
|
function fakeDoneHandler() {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
1207
|
+
var promiseRef = promiseReference();
|
|
1208
|
+
var doneHandler = promiseRef.resolve;
|
|
1209
|
+
var failHandler = function failHandler(e) {
|
|
1210
|
+
promiseRef.reject(e);
|
|
1211
|
+
};
|
|
1212
|
+
var fakeDone = function fakeDone(error) {
|
|
1213
|
+
if (error) {
|
|
1214
|
+
failHandler(error);
|
|
1215
|
+
} else {
|
|
1216
|
+
doneHandler(0);
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
fakeDone.fail = function(error) {
|
|
1220
|
+
failHandler(error);
|
|
1221
|
+
};
|
|
1222
|
+
fakeDone._ref = promiseRef;
|
|
1223
|
+
fakeDone.promise = promiseRef.promise;
|
|
1224
|
+
fakeDone.resolve = promiseRef.resolve;
|
|
1225
|
+
fakeDone.reject = promiseRef.reject;
|
|
1226
|
+
return fakeDone;
|
|
591
1227
|
}
|
|
592
1228
|
|
|
1229
|
+
function _assert_this_initialized$1(self) {
|
|
1230
|
+
if (self === void 0) {
|
|
1231
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1232
|
+
}
|
|
1233
|
+
return self;
|
|
1234
|
+
}
|
|
1235
|
+
function _call_super$1(_this, derived, args) {
|
|
1236
|
+
derived = _get_prototype_of$1(derived);
|
|
1237
|
+
return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
|
|
1238
|
+
}
|
|
1239
|
+
function _class_call_check$1(instance, Constructor) {
|
|
1240
|
+
if (!(instance instanceof Constructor)) {
|
|
1241
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
function _get_prototype_of$1(o) {
|
|
1245
|
+
_get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
1246
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1247
|
+
};
|
|
1248
|
+
return _get_prototype_of$1(o);
|
|
1249
|
+
}
|
|
1250
|
+
function _inherits$1(subClass, superClass) {
|
|
1251
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1252
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1253
|
+
}
|
|
1254
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1255
|
+
constructor: {
|
|
1256
|
+
value: subClass,
|
|
1257
|
+
writable: true,
|
|
1258
|
+
configurable: true
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1261
|
+
if (superClass) _set_prototype_of$1(subClass, superClass);
|
|
1262
|
+
}
|
|
1263
|
+
function _possible_constructor_return$1(self, call) {
|
|
1264
|
+
if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
|
|
1265
|
+
return call;
|
|
1266
|
+
}
|
|
1267
|
+
return _assert_this_initialized$1(self);
|
|
1268
|
+
}
|
|
1269
|
+
function _set_prototype_of$1(o, p) {
|
|
1270
|
+
_set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1271
|
+
o.__proto__ = p;
|
|
1272
|
+
return o;
|
|
1273
|
+
};
|
|
1274
|
+
return _set_prototype_of$1(o, p);
|
|
1275
|
+
}
|
|
1276
|
+
function _type_of$1(obj) {
|
|
1277
|
+
"@swc/helpers - typeof";
|
|
1278
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1279
|
+
}
|
|
1280
|
+
function _is_native_reflect_construct$1() {
|
|
1281
|
+
try {
|
|
1282
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1283
|
+
} catch (_) {}
|
|
1284
|
+
return (_is_native_reflect_construct$1 = function() {
|
|
1285
|
+
return !!result;
|
|
1286
|
+
})();
|
|
1287
|
+
}
|
|
593
1288
|
/**
|
|
594
1289
|
* @deprecated Use AbstractTestContextFixture from shared instead. This is kept for backwards compatibility.
|
|
595
|
-
*/
|
|
596
|
-
|
|
1290
|
+
*/ var AbstractJestTestContextFixture = /*#__PURE__*/ function(AbstractTestContextFixture) {
|
|
1291
|
+
_inherits$1(AbstractJestTestContextFixture, AbstractTestContextFixture);
|
|
1292
|
+
function AbstractJestTestContextFixture() {
|
|
1293
|
+
_class_call_check$1(this, AbstractJestTestContextFixture);
|
|
1294
|
+
return _call_super$1(this, AbstractJestTestContextFixture, arguments);
|
|
1295
|
+
}
|
|
1296
|
+
return AbstractJestTestContextFixture;
|
|
1297
|
+
}(AbstractTestContextFixture);
|
|
597
1298
|
/**
|
|
598
1299
|
* @deprecated Use AbstractChildTestContextFixture from shared instead. This is kept for backwards compatibility.
|
|
599
|
-
*/
|
|
600
|
-
|
|
1300
|
+
*/ var AbstractChildJestTestContextFixture = /*#__PURE__*/ function(AbstractChildTestContextFixture) {
|
|
1301
|
+
_inherits$1(AbstractChildJestTestContextFixture, AbstractChildTestContextFixture);
|
|
1302
|
+
function AbstractChildJestTestContextFixture() {
|
|
1303
|
+
_class_call_check$1(this, AbstractChildJestTestContextFixture);
|
|
1304
|
+
return _call_super$1(this, AbstractChildJestTestContextFixture, arguments);
|
|
1305
|
+
}
|
|
1306
|
+
return AbstractChildJestTestContextFixture;
|
|
1307
|
+
}(AbstractChildTestContextFixture);
|
|
601
1308
|
/**
|
|
602
1309
|
* @deprecated Use testContextBuilder from shared instead. This is kept for backwards compatibility.
|
|
603
|
-
*/
|
|
604
|
-
const jestTestContextBuilder = testContextBuilder;
|
|
1310
|
+
*/ var jestTestContextBuilder = testContextBuilder;
|
|
605
1311
|
/**
|
|
606
1312
|
* @deprecated Use useContextFixture from shared instead. This is kept for backwards compatibility.
|
|
607
|
-
*/
|
|
608
|
-
const useJestContextFixture = useTestContextFixture;
|
|
1313
|
+
*/ var useJestContextFixture = useTestContextFixture;
|
|
609
1314
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
1315
|
+
function _assert_this_initialized(self) {
|
|
1316
|
+
if (self === void 0) {
|
|
1317
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1318
|
+
}
|
|
1319
|
+
return self;
|
|
1320
|
+
}
|
|
1321
|
+
function _call_super(_this, derived, args) {
|
|
1322
|
+
derived = _get_prototype_of(derived);
|
|
1323
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
1324
|
+
}
|
|
1325
|
+
function _class_call_check(instance, Constructor) {
|
|
1326
|
+
if (!(instance instanceof Constructor)) {
|
|
1327
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
function _get_prototype_of(o) {
|
|
1331
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
1332
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1333
|
+
};
|
|
1334
|
+
return _get_prototype_of(o);
|
|
1335
|
+
}
|
|
1336
|
+
function _inherits(subClass, superClass) {
|
|
1337
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1338
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1339
|
+
}
|
|
1340
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1341
|
+
constructor: {
|
|
1342
|
+
value: subClass,
|
|
1343
|
+
writable: true,
|
|
1344
|
+
configurable: true
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
1348
|
+
}
|
|
1349
|
+
function _possible_constructor_return(self, call) {
|
|
1350
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
1351
|
+
return call;
|
|
1352
|
+
}
|
|
1353
|
+
return _assert_this_initialized(self);
|
|
1354
|
+
}
|
|
1355
|
+
function _set_prototype_of(o, p) {
|
|
1356
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1357
|
+
o.__proto__ = p;
|
|
1358
|
+
return o;
|
|
1359
|
+
};
|
|
1360
|
+
return _set_prototype_of(o, p);
|
|
1361
|
+
}
|
|
1362
|
+
function _type_of(obj) {
|
|
1363
|
+
"@swc/helpers - typeof";
|
|
1364
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1365
|
+
}
|
|
1366
|
+
function _is_native_reflect_construct() {
|
|
1367
|
+
try {
|
|
1368
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1369
|
+
} catch (_) {}
|
|
1370
|
+
return (_is_native_reflect_construct = function() {
|
|
1371
|
+
return !!result;
|
|
1372
|
+
})();
|
|
1373
|
+
}
|
|
615
1374
|
/**
|
|
616
1375
|
* @deprecated Use failWithTestDoneCallback from shared instead. This is kept for backwards compatibility.
|
|
617
|
-
*/
|
|
618
|
-
const failWithJestDoneCallback = failWithTestDoneCallback;
|
|
1376
|
+
*/ var failWithJestDoneCallback = failWithTestDoneCallback;
|
|
619
1377
|
// MARK: Errors
|
|
620
1378
|
/**
|
|
621
1379
|
* @deprecated Use ExpectedFailError from shared instead. This is kept for backwards compatibility.
|
|
622
|
-
*/
|
|
623
|
-
|
|
1380
|
+
*/ var JestExpectedFailError = /*#__PURE__*/ function(ExpectedFailError) {
|
|
1381
|
+
_inherits(JestExpectedFailError, ExpectedFailError);
|
|
1382
|
+
function JestExpectedFailError() {
|
|
1383
|
+
_class_call_check(this, JestExpectedFailError);
|
|
1384
|
+
return _call_super(this, JestExpectedFailError, arguments);
|
|
1385
|
+
}
|
|
1386
|
+
return JestExpectedFailError;
|
|
1387
|
+
}(ExpectedFailError);
|
|
624
1388
|
/**
|
|
625
1389
|
* @deprecated Use UnexpectedSuccessFailureError from shared instead. This is kept for backwards compatibility.
|
|
626
|
-
*/
|
|
627
|
-
|
|
1390
|
+
*/ var JestUnexpectedSuccessFailureError = /*#__PURE__*/ function(UnexpectedSuccessFailureError) {
|
|
1391
|
+
_inherits(JestUnexpectedSuccessFailureError, UnexpectedSuccessFailureError);
|
|
1392
|
+
function JestUnexpectedSuccessFailureError() {
|
|
1393
|
+
_class_call_check(this, JestUnexpectedSuccessFailureError);
|
|
1394
|
+
return _call_super(this, JestUnexpectedSuccessFailureError, arguments);
|
|
1395
|
+
}
|
|
1396
|
+
return JestUnexpectedSuccessFailureError;
|
|
1397
|
+
}(UnexpectedSuccessFailureError);
|
|
628
1398
|
/**
|
|
629
1399
|
* @deprecated Use ExpectedErrorOfSpecificTypeError from shared instead. This is kept for backwards compatibility.
|
|
630
|
-
*/
|
|
631
|
-
|
|
1400
|
+
*/ var JestExpectedErrorOfSpecificTypeError = /*#__PURE__*/ function(ExpectedErrorOfSpecificTypeError) {
|
|
1401
|
+
_inherits(JestExpectedErrorOfSpecificTypeError, ExpectedErrorOfSpecificTypeError);
|
|
1402
|
+
function JestExpectedErrorOfSpecificTypeError() {
|
|
1403
|
+
_class_call_check(this, JestExpectedErrorOfSpecificTypeError);
|
|
1404
|
+
return _call_super(this, JestExpectedErrorOfSpecificTypeError, arguments);
|
|
1405
|
+
}
|
|
1406
|
+
return JestExpectedErrorOfSpecificTypeError;
|
|
1407
|
+
}(ExpectedErrorOfSpecificTypeError);
|
|
632
1408
|
/**
|
|
633
1409
|
* @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
|
|
634
|
-
*/
|
|
635
|
-
|
|
636
|
-
failWithTestDoneCallback(done, failDueToSuccessError());
|
|
1410
|
+
*/ function failWithDoneDueToSuccess(done) {
|
|
1411
|
+
failWithTestDoneCallback(done, failDueToSuccessError());
|
|
637
1412
|
}
|
|
638
1413
|
/**
|
|
639
1414
|
* @deprecated Use expectFailAssertErrorType from shared instead. This is kept for backwards compatibility.
|
|
640
|
-
*/
|
|
641
|
-
const jestExpectFailAssertErrorType = expectFailAssertErrorType;
|
|
1415
|
+
*/ var jestExpectFailAssertErrorType = expectFailAssertErrorType;
|
|
642
1416
|
|
|
643
1417
|
/**
|
|
644
1418
|
* Wraps the input JestTestContextFactory to emit another type of Fixture for tests.
|
|
645
1419
|
*
|
|
646
1420
|
* @deprecated Use wrapTestContextFactory from shared instead. This is kept for backwards compatibility.
|
|
647
1421
|
* @returns
|
|
648
|
-
*/
|
|
649
|
-
const wrapJestTestContextFactory = wrapTestContextFactory;
|
|
1422
|
+
*/ var wrapJestTestContextFactory = wrapTestContextFactory;
|
|
650
1423
|
/**
|
|
651
1424
|
* @deprecated Use instanceWrapTestContextFactory from shared instead. This is kept for backwards compatibility.
|
|
652
|
-
*/
|
|
653
|
-
const instanceWrapJestTestContextFactory = instanceWrapTestContextFactory;
|
|
1425
|
+
*/ var instanceWrapJestTestContextFactory = instanceWrapTestContextFactory;
|
|
654
1426
|
|
|
655
1427
|
/**
|
|
656
1428
|
* @deprecated Use useTestFunctionFixture from shared instead. This is kept for backwards compatibility.
|
|
657
|
-
*/
|
|
658
|
-
const useJestFunctionFixture = useTestFunctionFixture;
|
|
1429
|
+
*/ var useJestFunctionFixture = useTestFunctionFixture;
|
|
659
1430
|
/**
|
|
660
1431
|
* @deprecated Use useTestFunctionMapFixture from shared instead. This is kept for backwards compatibility.
|
|
661
|
-
*/
|
|
662
|
-
const useJestFunctionMapFixture = useTestFunctionMapFixture;
|
|
1432
|
+
*/ var useJestFunctionMapFixture = useTestFunctionMapFixture;
|
|
663
1433
|
|
|
664
1434
|
export { AbstractChildJestTestContextFixture, AbstractChildTestContextFixture, AbstractJestTestContextFixture, AbstractTestContextFixture, AbstractWrappedFixture, AbstractWrappedFixtureWithInstance, EXPECT_ERROR_DEFAULT_HANDLER, ExpectedErrorOfSpecificTypeError, ExpectedFailError, JestExpectedErrorOfSpecificTypeError, JestExpectedFailError, JestUnexpectedSuccessFailureError, UnexpectedSuccessFailureError, callbackTest, expectFail, expectFailAssertErrorType, expectSuccessfulFail, failDueToSuccess, failDueToSuccessError, failSuccessfully, failSuccessfullyError, failTest, failWithDoneDueToSuccess, failWithJestDoneCallback, failWithTestDoneCallback, fakeDoneHandler, instanceWrapJestTestContextFactory, instanceWrapTestContextFactory, itShouldFail, jestExpectFailAssertErrorType, jestTestContextBuilder, shouldFail, testContextBuilder, testDoneCallbackRef, useJestContextFixture, useJestFunctionFixture, useJestFunctionMapFixture, useTestContextFixture, useTestFunctionFixture, useTestFunctionMapFixture, wrapJestTestContextFactory, wrapTestContextFactory };
|