lml-main
Version:
This is now a mono repository published into many standalone packages.
76 lines • 3.54 kB
JavaScript
;
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var redux_rx_http_1 = require("redux-rx-http");
var ts_utils_1 = require("@lml/ts-utils");
require("rxjs");
var actions_1 = require("../actions");
var fetch_jobs_by_status_1 = require("../epics/fetch-jobs-by-status");
var mocks_1 = require("../../allocation/mocks");
var actions_2 = require("../../allocation/actions");
describe('fetchJobsByStatus Epic', function () {
it('fetchJobsByStatus should dispatch setAllocationByIdBatch', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var allocation, result, response, action, actions, _a, _b;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
allocation = mocks_1.mockAllocation();
result = {
allocations: {
jobs: (_a = {},
_a[allocation.job.refId] = {
actual: allocation,
},
_a)
}
};
response = ts_utils_1.mockResponse(result);
action = redux_rx_http_1.rxHttpSuccess(response, undefined, { jobId: allocation.job.refId }, // args
actions_1.FETCH_JOBS_BY_STATUS);
return [4 /*yield*/, ts_utils_1.getEpicActions(fetch_jobs_by_status_1.fetchJobsByStatusSuccess, action)];
case 1:
actions = _c.sent();
expect.objectContaining({
type: actions_2.SET_ALLOCATIONS_BY_ID_BATCH,
allocations: (_b = {},
_b[allocation.job.refId] = allocation,
_b),
});
return [2 /*return*/];
}
});
}); });
it('fetchJobsByStatus should dispatch setAllocationByIdBatch', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var tag, result, response, action, actions, _a, _b;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
tag = mocks_1.mockAllocation('TAG');
result = {
allocations: {
jobs: (_a = {},
_a[tag.job.refId] = {
tag: tag,
},
_a)
}
};
response = ts_utils_1.mockResponse(result);
action = redux_rx_http_1.rxHttpSuccess(response, undefined, { jobId: tag.job.refId }, // args
actions_1.FETCH_JOBS_BY_STATUS);
return [4 /*yield*/, ts_utils_1.getEpicActions(fetch_jobs_by_status_1.fetchJobsByStatusSuccess, action)];
case 1:
actions = _c.sent();
expect.objectContaining({
type: actions_2.SET_TAGS_BY_ID_BATCH,
tags: (_b = {},
_b[tag.job.refId] = tag,
_b),
});
return [2 /*return*/];
}
});
}); });
});
//# sourceMappingURL=status.epic.spec.js.map