Skip to content

Commit

Permalink
Completing test
Browse files Browse the repository at this point in the history
  • Loading branch information
lauracc97 committed Apr 24, 2024
1 parent d02630e commit aa128ab
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions users/authservice/auth-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,25 @@ describe('Auth Service', () => {
expect(response.body).toHaveProperty('error', 'La contraseña no puede estar vacía');
});

it('should return 401 if username or password is incorrect', async () => {
const userError3 = {
username: 'wrongusername',
password: 'wrongpassword',

};

const response = await request(app).post('/login').send(userError3);
expect(response.status).toBe(401);
expect(response.body).toHaveProperty('error', 'Credenciales inválidas');
});

it('should return 500 if there is a server error', async () => {
const userError4 = {
username: 'wrongFormat',
};

const response = await request(app).post('/login').send(userError4);
expect(response.status).toBe(500);
expect(response.body).toHaveProperty('error', 'Internal Server Error');
});
});

0 comments on commit aa128ab

Please sign in to comment.