refactor: Use fixtures for getUser graphQL tests

This commit is contained in:
Faruk AYDIN
2023-10-04 18:15:55 +02:00
parent ffb2f4f5db
commit a29b3c6db4
4 changed files with 102 additions and 69 deletions

15
packages/backend/test/fixtures/role.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
type RoleParams = {
name?: string;
key?: string;
};
const createRole = async (params: RoleParams = {}) => {
params.name = params?.name || 'Viewer';
params.key = params?.key || 'viewer';
const [role] = await knex.table('roles').insert(params).returning('*');
return role;
};
export default createRole;