lml-main
Version:
This is now a mono repository published into many standalone packages.
47 lines • 2.29 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_job_by_id_1 = require("../epics/fetch-job-by-id");
var mocks_1 = require("../mocks");
describe('fetchJobByIdEpic', function () {
it('on successful FETCH, SET_JOB_BY_ID', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var result, response, action, actions;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
result = {
job: tslib_1.__assign({}, mocks_1.mockJob('123')),
jobStatus: tslib_1.__assign({}, mocks_1.mockJobStatus('live')),
incidents: tslib_1.__assign({}, mocks_1.mockIncident('123')),
};
response = ts_utils_1.mockResponse(result);
action = redux_rx_http_1.rxHttpSuccess(response, undefined, { refId: '123' }, actions_1.FETCH_JOB_BY_ID);
return [4 /*yield*/, ts_utils_1.getEpicActions(fetch_job_by_id_1.fetchJobByIdSuccess, action)];
case 1:
actions = _a.sent();
expect(actions).toMatchObject([
expect.objectContaining({
type: actions_1.SET_JOB_BY_ID,
job: expect.objectContaining(result.job),
}),
expect.objectContaining({
type: actions_1.SET_JOB_STATUS_BY_ID,
jobStatus: expect.objectContaining(result.jobStatus),
}),
expect.objectContaining({
type: actions_1.SET_JOB_INCIDENTS_BATCH,
refId: '123',
incidents: expect.objectContaining(result.incidents),
}),
]);
return [2 /*return*/];
}
});
}); });
});
//# sourceMappingURL=fetch-job-by-id.epic.spec.js.map