From 1649f960661e279430218d77f06862523662ec04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20D=C3=ADaz=20Cancillo?= Date: Sun, 28 Apr 2024 13:37:13 +0200 Subject: [PATCH] probando --- webapp/src/components/Login.test.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/webapp/src/components/Login.test.js b/webapp/src/components/Login.test.js index 3d6685e7..10625052 100644 --- a/webapp/src/components/Login.test.js +++ b/webapp/src/components/Login.test.js @@ -11,22 +11,14 @@ const mockAxios = new MockAdapter(axios); // Define the test suite describe('Login Component', () => { - // Define the test - test('renders login button', () => { - // Render the Login component - render( {}} />); - - // Check if the login button is in the document - const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); - expect(loginButton).toBeInTheDocument(); - }); - axios.post.mockImplementation((url, data) => { if (url.endsWith('/login')) { console.error("En login estamos manejandonos con el mock de axios"); //borrar return Promise.resolve({ data: { createdAt: 'mockedToken' } }); }else if (url.endsWith('/createUserRank')) { return Promise.resolve({ data: { rankId: 'mockedRankId' } }); + }else{ + console.error("NO ENTRAMOS "+url + " - " + data); } }); @@ -35,6 +27,15 @@ describe('Login Component', () => { return Promise.resolve({ data: { users: ['user1', 'user2'] } }); } }); + // Define the test + test('renders login button', () => { + // Render the Login component + render( {}} />); + + // Check if the login button is in the document + const loginButton = screen.getByRole('button', { name: /Iniciar sesión/i }); + expect(loginButton).toBeInTheDocument(); + }); test('login with valid normal (not "admin") credentials', async () => { const setLogged = jest.fn();