From bc8290de64291319d04a4fd29b1dea91dbd34d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20D=C3=ADaz=20Cancillo?= Date: Sun, 28 Apr 2024 15:46:09 +0200 Subject: [PATCH] Sigo refactorizando --- webapp/src/components/Login.js | 1 - webapp/src/components/Login.test.js | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/src/components/Login.js b/webapp/src/components/Login.js index 4a65040a..49028c5a 100644 --- a/webapp/src/components/Login.js +++ b/webapp/src/components/Login.js @@ -46,7 +46,6 @@ const Login = ({ setLogged }) => { const response = await axios.post(`${apiEndpoint}/login`, { username, password }); const { createdAt: userCreatedAt } = response.data; await axios.get(`${apiEndpoint}/getAllUsers`); - // const users = usersResponse.data; setCreatedAt(userCreatedAt); setLoginSuccess(true); setLogged(); diff --git a/webapp/src/components/Login.test.js b/webapp/src/components/Login.test.js index 11f82d58..bf4feb04 100644 --- a/webapp/src/components/Login.test.js +++ b/webapp/src/components/Login.test.js @@ -195,7 +195,7 @@ describe('Login Component', () => { }); await waitFor(() => { - if (loggedIn) { + if (!loggedIn) { expect(setLogged).not.toHaveBeenCalled(); } else { expect(setLogged).toHaveBeenCalled(); @@ -247,7 +247,6 @@ describe('Login Component', () => { // Mock para la peticiĆ³n POST de login fallada axios.post.mockRejectedValueOnce({ response: { status: 500, data: { error: 'Internal Server Error' } } }); - performLoginFail(setLogged, 'testUser', 'testPassword', 'Internal Server Error', false); await performLoginFail(setLogged, 'testUser', 'testPassword', 'Espere, estamos cargando sus datos...', true); }); });