Răsfoiți Sursa

✅ test(user): enhance user creation test with debugging and verification

- add originalUserData to preserve initial user data before any modifications
- add debug logs to track original and hashed passwords for troubleshooting
- update password comparison to use originalUserData for accurate verification of hashing
yourname 4 săptămâni în urmă
părinte
comite
d41e87ea76

+ 8 - 1
packages/user-module/tests/integration/user.integration.test.ts

@@ -45,14 +45,21 @@ describe('User Integration Tests', () => {
         email: 'integration@example.com',
         nickname: 'Integration User'
       };
+      const originalUserData = {
+        ...userData
+      }
 
       const createdUser = await userService.createUser(userData);
 
+      console.debug('Original userData:', originalUserData);
+      console.debug('Original password:', userData.password);
+      console.debug('Hashed password:', createdUser.password);
+
       expect(createdUser.id).toBeDefined();
       expect(createdUser.username).toBe(userData.username);
       expect(createdUser.email).toBe(userData.email);
       expect(createdUser.nickname).toBe(userData.nickname);
-      expect(createdUser.password).not.toBe(userData.password); // Password should be hashed
+      expect(createdUser.password).not.toBe(originalUserData.password); // Password should be hashed
 
       // Retrieve user
       const retrievedUser = await userService.getUserById(createdUser.id);