@ply-ct/ply
Version:
REST API Automated Testing
29 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SyncExec = void 0;
const exec_1 = require("./exec");
class SyncExec extends exec_1.StepExec {
async run(context) {
const mode = context.getAttribute('mode');
const awaitAll = !(mode === null || mode === void 0 ? void 0 : mode.startsWith('Await any'));
if (awaitAll) {
const upstreamSteps = (context.flow.steps || []).filter((step) => { var _a; return (_a = step.links) === null || _a === void 0 ? void 0 : _a.find((link) => link.to === context.step.id); });
const done = upstreamSteps.every((step) => {
var _a;
const stepInstance = (_a = context.flowInstance.stepInstances) === null || _a === void 0 ? void 0 : _a.find((si) => si.stepId === step.id);
return (stepInstance === null || stepInstance === void 0 ? void 0 : stepInstance.status) === 'Completed';
});
if (done) {
return { status: 'Passed' };
}
else {
return { status: 'Waiting' };
}
}
else {
return { status: 'Passed' };
}
}
}
exports.SyncExec = SyncExec;
//# sourceMappingURL=sync.js.map