Merge pull request #1379 from automatisch/factories/execution-step

test: Implement execution step factory
This commit is contained in:
Ömer Faruk Aydın
2023-10-24 13:45:08 +02:00
committed by GitHub
3 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
import ExecutionStep from '../../src/models/execution-step';
import { createExecution } from './execution';
import { createStep } from './step';
export const createExecutionStep = async (
params: Partial<ExecutionStep> = {}
) => {
params.executionId = params?.executionId || (await createExecution()).id;
params.stepId = params?.stepId || (await createStep()).id;
params.status = params?.status || 'success';
params.dataIn = params?.dataIn || { dataIn: 'dataIn' };
params.dataOut = params?.dataOut || { dataOut: 'dataOut' };
const [executionStep] = await global.knex
.table('executionSteps')
.insert(params)
.returning('*');
return executionStep;
};

View File

@@ -6,7 +6,7 @@ export const createExecution = async (params: Partial<Execution> = {}) => {
params.testRun = params?.testRun || false;
const [execution] = await global.knex
.table('execution')
.table('executions')
.insert(params)
.returning('*');

View File

@@ -5,7 +5,7 @@ export const createStep = async (params: Partial<Step> = {}) => {
params.flowId = params?.flowId || (await createFlow()).id;
params.type = params?.type || 'action';
const [lastStep] = await global.knex
const lastStep = await global.knex
.table('steps')
.where('flowId', params.flowId)
.andWhere('deletedAt', '!=', null)