Merge pull request #1350 from automatisch/test/get-config

test: Implement tests for getConfig graphQL query
This commit is contained in:
Ömer Faruk Aydın
2023-10-16 15:12:53 +02:00
committed by GitHub
4 changed files with 129 additions and 10 deletions

View File

@@ -0,0 +1,23 @@
import { IJSONObject } from '@automatisch/types';
import { faker } from '@faker-js/faker';
type ConfigParams = {
key?: string;
value?: IJSONObject;
};
const createConfig = async (params: ConfigParams = {}) => {
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;
};
export default createConfig;