Merge pull request #1377 from automatisch/factories/execution
test: Implement factory for the execution model
This commit is contained in:
14
packages/backend/test/factories/execution.ts
Normal file
14
packages/backend/test/factories/execution.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import Execution from '../../src/models/execution';
|
||||
import { createFlow } from './flow';
|
||||
|
||||
export const createExecution = async (params: Partial<Execution> = {}) => {
|
||||
params.flowId = params?.flowId || (await createFlow()).id;
|
||||
params.testRun = params?.testRun || false;
|
||||
|
||||
const [execution] = await global.knex
|
||||
.table('execution')
|
||||
.insert(params)
|
||||
.returning('*');
|
||||
|
||||
return execution;
|
||||
};
|
Reference in New Issue
Block a user