Skip to content

Commit

Permalink
Añadido test que faltaba de gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276026 committed Apr 28, 2024
1 parent 5b1fa38 commit aedfdee
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions gatewayservice/gateway-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
});

});

0 comments on commit aedfdee

Please sign in to comment.