final ts cleanup?

This commit is contained in:
2025-12-21 23:39:13 -08:00
parent b14225f69f
commit 368b8e704c
8 changed files with 674 additions and 438 deletions

View File

@@ -20,24 +20,29 @@ describe('Database Service Integration Tests', () => {
});
// Act: Call the createUser function
const createdUser = await db.userRepo.createUser(email, passwordHash, { full_name: fullName }, logger);
const createdUser = await db.userRepo.createUser(
email,
passwordHash,
{ full_name: fullName },
logger,
);
// Assert: Check that the user was created with the correct details
expect(createdUser).toBeDefined();
expect(createdUser.user.email).toBe(email);
expect(createdUser.user_id).toBeTypeOf('string');
expect(createdUser.user.email).toBe(email); // This is correct
expect(createdUser.user.user_id).toBeTypeOf('string');
// Act: Try to find the user we just created
const foundUser = await db.userRepo.findUserByEmail(email, logger);
// Assert: Check that the found user matches the created user
expect(foundUser).toBeDefined();
expect(foundUser?.user_id).toBe(createdUser.user_id);
expect(foundUser?.user_id).toBe(createdUser.user.user_id);
expect(foundUser?.email).toBe(email);
// Also, verify the profile was created by the trigger
const profile = await db.userRepo.findUserProfileById(createdUser.user_id, logger);
const profile = await db.userRepo.findUserProfileById(createdUser.user.user_id, logger);
expect(profile).toBeDefined();
expect(profile?.full_name).toBe(fullName);
});
});
});