From 6116650f7a03f8f47eb25f1a41f28b22f1c29eda Mon Sep 17 00:00:00 2001 From: baraganio Date: Sat, 27 Apr 2024 22:59:39 +0200 Subject: [PATCH] =?UTF-8?q?Intentando=20eliminar=20securityHospots=20y=20c?= =?UTF-8?q?=C3=B3digo=20duplicado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/authservice/auth-service.test.js | 7 +++---- users/userservice/user-service.test.js | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/users/authservice/auth-service.test.js b/users/authservice/auth-service.test.js index 9880ca26..d3a63bd6 100644 --- a/users/authservice/auth-service.test.js +++ b/users/authservice/auth-service.test.js @@ -9,19 +9,18 @@ let app; //test user const user = { username: 'testuser', - password: 'testpassword', + password: 'a8d4Ae6_Ws', }; const user2 = { username: 'testuser', - password: 'wrongpass', + password: 'md32_sU634', }; async function addUser(user){ - const hashedPassword = await bcrypt.hash(user.password, 10); const newUser = new User({ username: user.username, - password: hashedPassword, + password: await bcrypt.hash(user.password, 10), }); await newUser.save(); diff --git a/users/userservice/user-service.test.js b/users/userservice/user-service.test.js index 5c3dbb17..e453ad51 100644 --- a/users/userservice/user-service.test.js +++ b/users/userservice/user-service.test.js @@ -7,8 +7,8 @@ let mongoServer; let app; const user = { - username: 'testuser', - password: 'testpassword', + username: 'usernameTest1', + password: 'Egw23_f8', }; async function addUser(user){ @@ -42,14 +42,14 @@ describe('User Service', () => { const response = await request(app).get('/getregisteredusers'); expect(response.status).toBe(200); expect(response.body.length).toBe(1); - expect(Array.from(response.body[0])[0]).toBe('testuser'); + expect(Array.from(response.body[0])[0]).toBe('usernameTest1'); }); // it('should add a new user on POST /adduser', async () => { const newUser = { username: 'testuser2', - password: 'testpassword2', + password: 'aUf54_f', }; const response = await request(app).post('/adduser').send(newUser); @@ -60,7 +60,7 @@ describe('User Service', () => { // it('trying to add a user without username', async () => { const newUser = { - password: 'testpassword', + password: 'emcio74_ws', }; const response = (await request(app).post('/adduser').send(newUser));