Merge pull request #1375 from automatisch/factories/flow
test: Add factory file for the flow model
This commit is contained in:
11
packages/backend/test/factories/flow.ts
Normal file
11
packages/backend/test/factories/flow.ts
Normal 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;
|
||||
};
|
Reference in New Issue
Block a user