Skip to content

Commit

Permalink
Fix chore/fixed tests bug upgrade packages (#16)
Browse files Browse the repository at this point in the history
* Fixed issue with db clear after tests

* Upgraded packages
  • Loading branch information
alexleboucher authored Jul 15, 2023
1 parent fc91b06 commit 93f7d27
Show file tree
Hide file tree
Showing 3 changed files with 541 additions and 430 deletions.
7 changes: 2 additions & 5 deletions __tests__/utils/testsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ export const closeDatabase = async () => {
* Clear the database data.
*/
export const clearDatabase = async () => {
const entities = AppDataSource.entityMetadatas;
for (const entity of entities) {
const repository = AppDataSource.getRepository(entity.name);
await repository.clear();
}
const entities = AppDataSource.entityMetadatas.map((entity) => `"${entity.tableName}"`).join(", ");
await AppDataSource.query(`TRUNCATE ${entities} CASCADE;`);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@
"@types/express": "^4.17.17",
"@types/express-session": "^1.17.7",
"@types/http-errors": "^2.0.1",
"@types/jest": "^29.5.2",
"@types/jest": "^29.5.3",
"@types/morgan": "^1.9.4",
"@types/node": "^20.3.2",
"@types/node": "^20.4.2",
"@types/passport": "^1.0.12",
"@types/passport-local": "^1.0.35",
"@types/supertest": "^2.0.12",
"@types/validator": "^13.7.17",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint": "^8.43.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.45.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.27.5",
"jest": "^29.5.0",
"nodemon": "^2.0.22",
"jest": "^29.6.1",
"nodemon": "^3.0.1",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
},
Expand Down
Loading

0 comments on commit 93f7d27

Please sign in to comment.