-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathhelper.js
33 lines (33 loc) · 1.17 KB
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";
/// <reference path="./global.d.ts" />
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
function sagaTestingHelper(generator, testFunction) {
var input = undefined;
var testFn = testFunction;
if (!testFn) {
testFn = it;
}
return function (title, fn) {
testFn(title, function () {
if (input instanceof Error) {
var result = generator.throw(input);
input = fn.apply(void 0, __spreadArray([result.value], arguments, false));
}
else {
var result = generator.next(input);
input = fn.apply(void 0, __spreadArray([result.value], arguments, false));
}
});
};
}
exports.default = sagaTestingHelper;
//# sourceMappingURL=helper.js.map