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

36
package-lock.json generated
View File

@ -13,7 +13,7 @@
"@grpc/proto-loader": "^0.7.4",
"@liaoliaots/nestjs-redis": "^9.0.5",
"@mobicoop/configuration-module": "^1.2.0",
"@mobicoop/ddd-library": "file:../../packages/dddlibrary",
"@mobicoop/ddd-library": "^1.0.0",
"@mobicoop/health-module": "^2.0.0",
"@mobicoop/message-broker-module": "^1.2.0",
"@nestjs/cache-manager": "^1.0.0",
@ -1788,9 +1788,9 @@
}
},
"node_modules/@mobicoop/ddd-library": {
"version": "0.3.0",
"resolved": "file:../../packages/dddlibrary",
"license": "AGPL",
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@mobicoop/ddd-library/-/ddd-library-1.0.0.tgz",
"integrity": "sha512-uOF2n2VqgfVP4QldEPGMuR3VPn0U5+XXQw5CK1E/9IHXIgiqdmAnKHX5qUpcr29mKbU5QvQbBuIyMeQqCFVu+w==",
"dependencies": {
"@nestjs/event-emitter": "^1.4.2",
"@nestjs/microservices": "^9.4.0",
@ -1832,6 +1832,34 @@
"@nestjs/common": "^9.4.2"
}
},
"node_modules/@mobicoop/health-module/node_modules/@mobicoop/ddd-library": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@mobicoop/ddd-library/-/ddd-library-0.3.0.tgz",
"integrity": "sha512-MoUDqlrDmJkumCFSyW9FY2DLbguT4rytFrmBt9tVNCr2Es6nlz4Ml3HVBwJTZrlJFU79XmiUQ5WAO0MHJt+nAg==",
"dependencies": {
"@nestjs/event-emitter": "^1.4.2",
"@nestjs/microservices": "^9.4.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"uuid": "^9.0.0"
},
"peerDependencies": {
"@nestjs/common": "^9.4.2"
}
},
"node_modules/@mobicoop/health-module/node_modules/@nestjs/event-emitter": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@nestjs/event-emitter/-/event-emitter-1.4.2.tgz",
"integrity": "sha512-5mskPMS4KVH6LghC+NynfdmGiMCOOv9CdgVpuWGipLrJECv5KWc7vaW5o/9BYrcqPkN7Ted6CJ+O4AfsTiRlgw==",
"dependencies": {
"eventemitter2": "6.4.9"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0",
"@nestjs/core": "^7.0.0 || ^8.0.0 || ^9.0.0",
"reflect-metadata": "^0.1.12"
}
},
"node_modules/@mobicoop/message-broker-module": {
"version": "1.2.0",
"license": "AGPL",

View File

@ -34,7 +34,7 @@
"@grpc/proto-loader": "^0.7.4",
"@liaoliaots/nestjs-redis": "^9.0.5",
"@mobicoop/configuration-module": "^1.2.0",
"@mobicoop/ddd-library": "file:../../packages/dddlibrary",
"@mobicoop/ddd-library": "^1.0.0",
"@mobicoop/health-module": "^2.0.0",
"@mobicoop/message-broker-module": "^1.2.0",
"@nestjs/cache-manager": "^1.0.0",

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