feat: Convert factories files to JS
This commit is contained in:
15
packages/backend/test/factories/config.js
Normal file
15
packages/backend/test/factories/config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
export const createConfig = async (params = {}) => {
|
||||
const configData = {
|
||||
key: params?.key || faker.lorem.word(),
|
||||
value: params?.value || { data: 'sampleConfig' },
|
||||
};
|
||||
|
||||
const [config] = await global.knex
|
||||
.table('config')
|
||||
.insert(configData)
|
||||
.returning('*');
|
||||
|
||||
return config;
|
||||
};
|
Reference in New Issue
Block a user