feat: Extend step serializer with last execution step
This commit is contained in:
@@ -13,6 +13,12 @@ const stepSerializer = (step) => {
|
|||||||
parameters: step.parameters,
|
parameters: step.parameters,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (step.lastExecutionStep) {
|
||||||
|
stepData.lastExecutionStep = executionStepSerializer(
|
||||||
|
step.lastExecutionStep
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (step.executionSteps?.length > 0) {
|
if (step.executionSteps?.length > 0) {
|
||||||
stepData.executionSteps = step.executionSteps.map((executionStep) =>
|
stepData.executionSteps = step.executionSteps.map((executionStep) =>
|
||||||
executionStepSerializer(executionStep)
|
executionStepSerializer(executionStep)
|
||||||
|
@@ -27,6 +27,18 @@ describe('stepSerializer', () => {
|
|||||||
expect(stepSerializer(step)).toEqual(expectedPayload);
|
expect(stepSerializer(step)).toEqual(expectedPayload);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return step data with the last execution step', async () => {
|
||||||
|
const executionStep = await createExecutionStep({ stepId: step.id });
|
||||||
|
|
||||||
|
step.lastExecutionStep = executionStep;
|
||||||
|
|
||||||
|
const expectedPayload = {
|
||||||
|
lastExecutionStep: executionStepSerializer(executionStep),
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(stepSerializer(step)).toMatchObject(expectedPayload);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return step data with the execution steps', async () => {
|
it('should return step data with the execution steps', async () => {
|
||||||
const executionStepOne = await createExecutionStep({ stepId: step.id });
|
const executionStepOne = await createExecutionStep({ stepId: step.id });
|
||||||
const executionStepTwo = await createExecutionStep({ stepId: step.id });
|
const executionStepTwo = await createExecutionStep({ stepId: step.id });
|
||||||
|
Reference in New Issue
Block a user