fix integration tests, update dddlibrary

This commit is contained in:
sbriat
2023-07-24 15:44:02 +02:00
parent e8c40a6386
commit 3a02dfce3e
3 changed files with 38 additions and 9 deletions

View File

@@ -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);