feat: Extend execution serializer with status

This commit is contained in:
Faruk AYDIN
2024-03-06 14:46:10 +01:00
parent f4d8d909b0
commit 25e231cd7c
2 changed files with 18 additions and 0 deletions

View File

@@ -8,6 +8,10 @@ const executionSerializer = (execution) => {
updatedAt: execution.updatedAt.getTime(), updatedAt: execution.updatedAt.getTime(),
}; };
if (execution.status) {
executionData.status = execution.status;
}
if (execution.flow) { if (execution.flow) {
executionData.flow = flowSerializer(execution.flow); executionData.flow = flowSerializer(execution.flow);
} }

View File

@@ -26,6 +26,20 @@ describe('executionSerializer', () => {
expect(executionSerializer(execution)).toEqual(expectedPayload); expect(executionSerializer(execution)).toEqual(expectedPayload);
}); });
it('should return the execution data with status', async () => {
execution.status = 'success';
const expectedPayload = {
id: execution.id,
testRun: execution.testRun,
createdAt: execution.createdAt.getTime(),
updatedAt: execution.updatedAt.getTime(),
status: 'success',
};
expect(executionSerializer(execution)).toEqual(expectedPayload);
});
it('should return the execution data with the flow', async () => { it('should return the execution data with the flow', async () => {
execution.flow = flow; execution.flow = flow;