feat(tests): enhance test database setup and cleanup for improved isolation and performance

This commit is contained in:
Dries Augustyns
2026-05-22 21:01:03 +02:00
parent 71e2277643
commit 32dd7bba46
5 changed files with 137 additions and 104 deletions
+3 -1
View File
@@ -108,7 +108,9 @@ export class TestFactories {
async createUser(options: UserFactoryOptions = {}) {
const email = options.email || `user-${uniqueId()}@test.com`;
const password = options.password || 'password123';
const hashedPassword = await bcrypt.hash(password, 10);
// Cost factor 4 is the bcrypt minimum — ~100x faster than the production cost of 10.
// Test users don't need real-world hash strength.
const hashedPassword = await bcrypt.hash(password, 4);
return this.prisma.user.create({
data: {