From aedfdeeece87bed0af291c77e42ec838c79d793e Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 14:48:23 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20test=20que=20faltaba=20de=20gate?= =?UTF-8?q?way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatewayservice/gateway-service.test.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/gatewayservice/gateway-service.test.js b/gatewayservice/gateway-service.test.js index c3e55c5..b76f343 100644 --- a/gatewayservice/gateway-service.test.js +++ b/gatewayservice/gateway-service.test.js @@ -194,23 +194,7 @@ describe('Gateway Service', () => { expect(response.status).toBe(401); // Esperamos un error de solicitud incorrecta }); - /* - it('debería manejar correctamente la carga excesiva', async () => { - // Realizar múltiples solicitudes simultáneas a endpoints diferentes - const promises = []; - for (let i = 0; i < 100; i++) { - promises.push(request(app).post('/login').send({ username: `user${i}`, password: 'password' })); - } - - // Esperar a que se completen todas las solicitudes - const responses = await Promise.all(promises); - - // Verificar que todas las respuestas tengan el código de estado esperado (200) - responses.forEach(response => { - expect(response.status).toBe(200); - }); - }); - */ + it('debería devolver un estado de salud "OK"', async () => { const response = await request(app).get('/health'); @@ -219,4 +203,10 @@ describe('Gateway Service', () => { expect(response.status).toBe(200); expect(response.body).toEqual({ status: 'OK' }); }); + + it('Debería devolver una lista de nombres de usuario cuando hay usuarios en la base de datos', async () => { + const response = await request(app).get('/getUsernames'); + expect(response.status).toBe(200); + }); + }); \ No newline at end of file