mirror of
https://gitlab.com/mobicoop/v3/service/user.git
synced 2026-01-11 22:02:39 +00:00
fix integration tests, update dddlibrary
This commit is contained in:
@@ -16,14 +16,13 @@ describe('User Repository', () => {
|
||||
let userRepository: UserRepository;
|
||||
|
||||
const executeInsertCommand = async (table: string, object: any) => {
|
||||
const command = `INSERT INTO ${table} ("${Object.keys(object).join(
|
||||
const command = `INSERT INTO "${table}" ("${Object.keys(object).join(
|
||||
'","',
|
||||
)}") VALUES (${Object.values(object).join(',')})`;
|
||||
|
||||
)}") VALUES ('${Object.values(object).join("','")}')`;
|
||||
await prismaService.$executeRawUnsafe(command);
|
||||
};
|
||||
const getSeed = (index: number, uuid: string): string => {
|
||||
return `'${uuid.slice(0, -2)}${index.toString(16).padStart(2, '0')}'`;
|
||||
return `${uuid.slice(0, -2)}${index.toString(16).padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
const baseUuid = {
|
||||
@@ -38,6 +37,8 @@ describe('User Repository', () => {
|
||||
lastName: `Doe${i}`,
|
||||
email: `john.doe${i}@email.com`,
|
||||
phone: `+33611223344${i}`,
|
||||
createdAt: '2023-07-24 13:07:05.000',
|
||||
updatedAt: '2023-07-24 13:07:05.000',
|
||||
};
|
||||
userToCreate.uuid = getSeed(i, baseUuid.uuid);
|
||||
await executeInsertCommand('user', userToCreate);
|
||||
|
||||
Reference in New Issue
Block a user