Skip to content

Commit 93f7d27

Browse files
Fix chore/fixed tests bug upgrade packages (#16)
* Fixed issue with db clear after tests * Upgraded packages
1 parent fc91b06 commit 93f7d27

File tree

3 files changed

+541
-430
lines changed

3 files changed

+541
-430
lines changed

__tests__/utils/testsHelpers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ export const closeDatabase = async () => {
5353
* Clear the database data.
5454
*/
5555
export const clearDatabase = async () => {
56-
const entities = AppDataSource.entityMetadatas;
57-
for (const entity of entities) {
58-
const repository = AppDataSource.getRepository(entity.name);
59-
await repository.clear();
60-
}
56+
const entities = AppDataSource.entityMetadatas.map((entity) => `"${entity.tableName}"`).join(", ");
57+
await AppDataSource.query(`TRUNCATE ${entities} CASCADE;`);
6158
}
6259

6360
/**

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
"@types/express": "^4.17.17",
3232
"@types/express-session": "^1.17.7",
3333
"@types/http-errors": "^2.0.1",
34-
"@types/jest": "^29.5.2",
34+
"@types/jest": "^29.5.3",
3535
"@types/morgan": "^1.9.4",
36-
"@types/node": "^20.3.2",
36+
"@types/node": "^20.4.2",
3737
"@types/passport": "^1.0.12",
3838
"@types/passport-local": "^1.0.35",
3939
"@types/supertest": "^2.0.12",
4040
"@types/validator": "^13.7.17",
41-
"@typescript-eslint/eslint-plugin": "^5.60.1",
42-
"@typescript-eslint/parser": "^5.60.1",
43-
"eslint": "^8.43.0",
41+
"@typescript-eslint/eslint-plugin": "^6.0.0",
42+
"@typescript-eslint/parser": "^6.0.0",
43+
"eslint": "^8.45.0",
4444
"eslint-import-resolver-typescript": "^3.5.5",
4545
"eslint-plugin-eslint-comments": "^3.2.0",
4646
"eslint-plugin-import": "^2.27.5",
47-
"jest": "^29.5.0",
48-
"nodemon": "^2.0.22",
47+
"jest": "^29.6.1",
48+
"nodemon": "^3.0.1",
4949
"supertest": "^6.3.3",
50-
"ts-jest": "^29.1.0",
50+
"ts-jest": "^29.1.1",
5151
"ts-node": "^10.9.1",
5252
"typescript": "^5.1.6"
5353
},

0 commit comments

Comments
 (0)