From 4d2172d153efbaa7ee38f7f49e3d7814321bccca Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Mon, 23 Oct 2023 22:52:24 +0200 Subject: [PATCH] test: Implement factory for the execution model --- packages/backend/test/factories/execution.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/backend/test/factories/execution.ts diff --git a/packages/backend/test/factories/execution.ts b/packages/backend/test/factories/execution.ts new file mode 100644 index 00000000..84748831 --- /dev/null +++ b/packages/backend/test/factories/execution.ts @@ -0,0 +1,14 @@ +import Execution from '../../src/models/execution'; +import { createFlow } from './flow'; + +export const createExecution = async (params: Partial = {}) => { + params.flowId = params?.flowId || (await createFlow()).id; + params.testRun = params?.testRun || false; + + const [execution] = await global.knex + .table('execution') + .insert(params) + .returning('*'); + + return execution; +};