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));