Skip to content

Commit

Permalink
Test de nombre de usuario existente
Browse files Browse the repository at this point in the history
  • Loading branch information
uo283182 committed Apr 25, 2024
1 parent ba45cc2 commit 4663ea1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions users/userservice/user-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ describe('User Service', () => {
expect(response.body).toHaveProperty('error', 'Missing required field: password');
});

it('should return 400 if the username already exists', async () => {
const userError3 = {
username: 'testuser',
password: 'test'
};

const response = await request(app).post('/adduser').send(userError3);
expect(response.status).toBe(400);
expect(response.body).toHaveProperty('error', 'Este nombre de usuario está en uso');
});

//For getting all users
it('should GET all the users', async () => {
const response = await request(app).get('/getAllUsers');
Expand Down

0 comments on commit 4663ea1

Please sign in to comment.