From 0f8e251425793c74bd1d0b9ebf835859072fb78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20M=C3=A9ndez=20Murias?= Date: Mon, 6 May 2024 01:49:40 +0200 Subject: [PATCH] Coverage increased --- users/userservice/user-service.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/users/userservice/user-service.test.js b/users/userservice/user-service.test.js index 606789d9..c09ccba9 100644 --- a/users/userservice/user-service.test.js +++ b/users/userservice/user-service.test.js @@ -59,6 +59,24 @@ describe('User Service', () => { const response = await request(app).post('/users').send(existingUser); expect(response.status).toBe(400); }); + it('should return an error when adding a user with an empty username on POST /users', async () => { + const user = { + username: '', + password: 'testpassword', + profileImage: 'perfil2.jpg', + }; + const response = await request(app).post('/users').send(user); + expect(response.status).toBe(400); + }); + it('should return an error when adding a user with an username too long on POST /users', async () => { + const user = { + username: 'qwertyuiopasdfghjklñzxcvbnmqwertyuiopasdfghjklñ', + password: 'testpassword', + profileImage: 'perfil2.jpg', + }; + const response = await request(app).post('/users').send(user); + expect(response.status).toBe(400); + }); it('should get user info on GET /users/:username', async () => { const username = 'defaultuser'; const response = await request(app).get(`/users/${username}`);