test: Add factory file for the flow model

This commit is contained in:
Faruk AYDIN
2023-10-23 10:53:32 +02:00
parent 855901bd9e
commit 16d0c243c7

View File

@@ -0,0 +1,11 @@
import Flow from '../../src/models/flow';
import { createUser } from './user';
export const createFlow = async (params: Partial<Flow> = {}) => {
params.userId = params?.userId || (await createUser()).id;
params.name = params?.name || 'Name your flow!';
const [flow] = await global.knex.table('flows').insert(params).returning('*');
return flow;
};