From de016cc0a3463fbc9d18c5d5f967b0d1de3daf53 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 18 Apr 2024 19:27:34 +0200 Subject: [PATCH 01/12] Test historial de preguntas --- webapp/src/components/HistoricalData.test.js | 54 ++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 webapp/src/components/HistoricalData.test.js diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js new file mode 100644 index 00000000..2de12890 --- /dev/null +++ b/webapp/src/components/HistoricalData.test.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import HistoricalData from './HistoricalData'; +import { BrowserRouter as Router } from 'react-router-dom'; + +const mockAxios = new MockAdapter(axios); + +describe('HistoricalData component', () => { + beforeEach(() => { + mockAxios.reset(); + }); + + it('muestra la página con el histórico de preguntas generadas', async () => { + + mockAxios.onGet("http://localhost:8000/historicaldata").reply(200, + { question: "¿Cual es la capital de Venezuela?", + correctOption: "Caracas", + incorrectOption1: "Doha", + incorrectOption2: "Barcelona", + incorrectOption3: "Nasáu" + }); + + render( + + ); + + const element = screen.getByText(/Historial de preguntas/); + const tableElement = screen.getByRole('table'); + + // Verifica si el elemento se encuentra en el DOM + expect(element).toBeInTheDocument(); + expect(tableElement).toBeInTheDocument(); + + + await waitFor(() => { + expect(screen.getByText('Pregunta')).toBeInTheDocument(); + expect(screen.getByText('Opción correcta')).toBeInTheDocument(); + expect(screen.getByText('Opción incorrecta 1')).toBeInTheDocument(); + expect(screen.getByText('Opción incorrecta 2')).toBeInTheDocument(); + expect(screen.getByText('Opción incorrecta 3')).toBeInTheDocument(); + + expect(screen.getByText('¿Cual es la capital de Venezuela?')).toBeInTheDocument(); + expect(screen.getByText('Caracas')).toBeInTheDocument(); + expect(screen.getByText('Doha')).toBeInTheDocument(); + expect(screen.getByText('Barcelona')).toBeInTheDocument(); + expect(screen.getByText('Nasáu')).toBeInTheDocument(); + + }); + }); +}); + + From b3d492520c7c91760316039df6058ba0e9741b8e Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 18 Apr 2024 19:37:21 +0200 Subject: [PATCH 02/12] Test historial de preguntas --- webapp/src/components/HistoricalData.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 2de12890..0b0a5bed 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import { render, fireEvent, screen, waitFor } from '@testing-library/react'; +import { render, screen, waitFor } from '@testing-library/react'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import HistoricalData from './HistoricalData'; @@ -26,7 +26,6 @@ describe('HistoricalData component', () => { ); - const element = screen.getByText(/Historial de preguntas/); const tableElement = screen.getByRole('table'); // Verifica si el elemento se encuentra en el DOM From fd1a602153cb43355018418eb0d46f41783b3c65 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 18 Apr 2024 19:44:13 +0200 Subject: [PATCH 03/12] Test historial de preguntas --- webapp/src/components/HistoricalData.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 0b0a5bed..8f1fb619 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -29,7 +29,6 @@ describe('HistoricalData component', () => { const tableElement = screen.getByRole('table'); // Verifica si el elemento se encuentra en el DOM - expect(element).toBeInTheDocument(); expect(tableElement).toBeInTheDocument(); From 8064d6086a9386bf92ea24005e1b46c3f06e69c6 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 18 Apr 2024 20:19:59 +0200 Subject: [PATCH 04/12] Test historial de preguntas --- webapp/src/components/HistoricalData.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 8f1fb619..44dbdd59 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -7,7 +7,7 @@ import { BrowserRouter as Router } from 'react-router-dom'; const mockAxios = new MockAdapter(axios); -describe('HistoricalData component', () => { +describe('HistoricalData', () => { beforeEach(() => { mockAxios.reset(); }); @@ -15,12 +15,12 @@ describe('HistoricalData component', () => { it('muestra la página con el histórico de preguntas generadas', async () => { mockAxios.onGet("http://localhost:8000/historicaldata").reply(200, - { question: "¿Cual es la capital de Venezuela?", + [{ question: "¿Cual es la capital de Venezuela?", correctOption: "Caracas", incorrectOption1: "Doha", incorrectOption2: "Barcelona", incorrectOption3: "Nasáu" - }); + }]); render( From 2005870dde5dac42f9b4133ad2e786553d44cca7 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 18 Apr 2024 20:26:10 +0200 Subject: [PATCH 05/12] Test historial de preguntas --- webapp/src/components/HistoricalData.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 44dbdd59..eabfdd7d 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -14,7 +14,7 @@ describe('HistoricalData', () => { it('muestra la página con el histórico de preguntas generadas', async () => { - mockAxios.onGet("http://localhost:8000/historicaldata").reply(200, + mockAxios.onGet("http://localhost:8000/getquestionshistory").reply(200, [{ question: "¿Cual es la capital de Venezuela?", correctOption: "Caracas", incorrectOption1: "Doha", From 4687f0ecd32fd0e3ae62c58169024925d4f3ac3b Mon Sep 17 00:00:00 2001 From: baraganio Date: Tue, 23 Apr 2024 21:41:12 +0200 Subject: [PATCH 06/12] =?UTF-8?q?A=C3=B1adiendo=20tests=20a=20userservice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/userservice/user-service.test.js | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/users/userservice/user-service.test.js b/users/userservice/user-service.test.js index 8dd8ea16..2281423c 100644 --- a/users/userservice/user-service.test.js +++ b/users/userservice/user-service.test.js @@ -1,9 +1,21 @@ const request = require('supertest'); const { MongoMemoryServer } = require('mongodb-memory-server'); +const bcrypt = require('bcrypt'); +const User = require('./user-model'); let mongoServer; let app; +async function addUser(user){ + const hashedPassword = await bcrypt.hash(user.password, 10); + const newUser = new User({ + username: user.username, + password: hashedPassword, + }); + + await newUser.save(); +} + beforeAll(async () => { mongoServer = await MongoMemoryServer.create(); const mongoUri = mongoServer.getUri(); @@ -17,6 +29,7 @@ afterAll(async () => { }); describe('User Service', () => { + // it('should add a new user on POST /adduser', async () => { const newUser = { username: 'testuser', @@ -27,4 +40,27 @@ describe('User Service', () => { expect(response.status).toBe(200); expect(response.body).toHaveProperty('username', 'testuser'); }); + + // + it('trying to add a user without username', async () => { + const newUser = { + password: 'testpassword', + }; + + const response = (await request(app).post('/adduser').send(newUser)); + expect(response.status).toBe(400); + expect(response.body).toHaveProperty( "error" , "Missing required field: username" ); + }); + + // + it('should get the registered users on /getregisteredusers', async () => { + addUser(user = { + username: 'testuser', + password: 'testpassword', + }); + const response = await request(app).get('/getregisteredusers'); + expect(response.status).toBe(200); + expect(response.body.length).toBe(1); + expect(Array.from(response.body[0])[0]).toBe('testuser'); + }); }); From 7eff51b7c3dcd050f9fffe5d4c420dd4b57aceb3 Mon Sep 17 00:00:00 2001 From: baraganio Date: Tue, 23 Apr 2024 21:47:09 +0200 Subject: [PATCH 07/12] =?UTF-8?q?A=C3=B1adiendo=20tests=20a=20authservice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/authservice/auth-service.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/users/authservice/auth-service.test.js b/users/authservice/auth-service.test.js index 7b55ee72..9880ca26 100644 --- a/users/authservice/auth-service.test.js +++ b/users/authservice/auth-service.test.js @@ -12,6 +12,11 @@ const user = { password: 'testpassword', }; +const user2 = { + username: 'testuser', + password: 'wrongpass', +}; + async function addUser(user){ const hashedPassword = await bcrypt.hash(user.password, 10); const newUser = new User({ @@ -42,4 +47,20 @@ describe('Auth Service', () => { expect(response.status).toBe(200); expect(response.body).toHaveProperty('username', 'testuser'); }); + + it('Should perform a fail login operation du to incorrect answer /login', async () => { + const response = await request(app).post('/login').send(user2); + expect(response.status).toBe(401); + expect(response.body).toHaveProperty('error', 'Invalid credentials'); + }); + + it('Should perform a server error due to missing value /login', async () => { + const response = await request(app).post('/login') + .send(user3 = { + username: 'testuser', + }); + expect(response.status).toBe(500); + expect(response.body).toHaveProperty('error', 'Internal Server Error'); + }); + }); From fe9b795091fb8a2abb33e678e926d71d73cdc02c Mon Sep 17 00:00:00 2001 From: uo264915 Date: Tue, 23 Apr 2024 21:57:12 +0200 Subject: [PATCH 08/12] Sincronizacion y tests --- webapp/src/components/HistoricalData.test.js | 6 ---- webapp/src/components/RegisteredUsers.test.js | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 webapp/src/components/RegisteredUsers.test.js diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index eabfdd7d..8d6ebca4 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -26,12 +26,6 @@ describe('HistoricalData', () => { ); - const tableElement = screen.getByRole('table'); - - // Verifica si el elemento se encuentra en el DOM - expect(tableElement).toBeInTheDocument(); - - await waitFor(() => { expect(screen.getByText('Pregunta')).toBeInTheDocument(); expect(screen.getByText('Opción correcta')).toBeInTheDocument(); diff --git a/webapp/src/components/RegisteredUsers.test.js b/webapp/src/components/RegisteredUsers.test.js new file mode 100644 index 00000000..824c9fec --- /dev/null +++ b/webapp/src/components/RegisteredUsers.test.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { render, screen, waitFor } from '@testing-library/react'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import {BrowserRouter as Router} from "react-router-dom"; +import RegisteredUsers from './RegisteredUsers'; + +const mockAxios = new MockAdapter(axios); + +describe('Registered Users component', () => { + beforeEach(() => { + mockAxios.reset(); + }); + + it('muestra todos los usuarios registrados', async () => { + + mockAxios.onGet("http://localhost:8000/RegisteredUsers").reply(200, + [{ username: "pablo", + fecha: "4/23/2024"}]); + + render( + + + ); + + await waitFor(() => { + + + expect(screen.getByText('pablo')).toBeInTheDocument(); + expect(screen.getByText('4/23/2024')).toBeInTheDocument(); + }); + + }); +}); \ No newline at end of file From 06055d91187aaa9d9ede9269cd9a0d8e25dd4fb1 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Thu, 25 Apr 2024 20:00:29 +0200 Subject: [PATCH 09/12] Test HisotircalData y RegisteredUsers --- webapp/src/components/HistoricalData.js | 13 ++++++++++-- webapp/src/components/HistoricalData.test.js | 21 +++++++++++++------ webapp/src/components/RegisteredUsers.js | 8 ++++++- webapp/src/components/RegisteredUsers.test.js | 1 - 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/webapp/src/components/HistoricalData.js b/webapp/src/components/HistoricalData.js index c07669f0..6045c211 100644 --- a/webapp/src/components/HistoricalData.js +++ b/webapp/src/components/HistoricalData.js @@ -62,13 +62,22 @@ const HistoricalData = () => { - {paginatedData.map((row, rowIndex) => ( + {/* {paginatedData.map((row, rowIndex) => ( {row.map((cell, cellIndex) => ( {cell} ))} - ))} + ))} */} + {paginatedData.map((row, rowIndex) => ( + + {row[0]} + {row[1]} + {row[2]} + {row[3]} + {row[4]} + + ))} diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 8d6ebca4..4e1dc9ec 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -20,24 +20,33 @@ describe('HistoricalData', () => { incorrectOption1: "Doha", incorrectOption2: "Barcelona", incorrectOption3: "Nasáu" - }]); + }, + { + question: "¿Cuál es la capital de Francia?", + correctOption: "París", + incorrectOption1: "Londres", + incorrectOption2: "Madrid", + incorrectOption3: "Roma" + } + ]); render( ); await waitFor(() => { - expect(screen.getByText('Pregunta')).toBeInTheDocument(); - expect(screen.getByText('Opción correcta')).toBeInTheDocument(); - expect(screen.getByText('Opción incorrecta 1')).toBeInTheDocument(); - expect(screen.getByText('Opción incorrecta 2')).toBeInTheDocument(); - expect(screen.getByText('Opción incorrecta 3')).toBeInTheDocument(); expect(screen.getByText('¿Cual es la capital de Venezuela?')).toBeInTheDocument(); expect(screen.getByText('Caracas')).toBeInTheDocument(); expect(screen.getByText('Doha')).toBeInTheDocument(); expect(screen.getByText('Barcelona')).toBeInTheDocument(); expect(screen.getByText('Nasáu')).toBeInTheDocument(); + + expect(screen.getByText('¿Cuál es la capital de Francia?')).toBeInTheDocument(); + expect(screen.getByText('París')).toBeInTheDocument(); + expect(screen.getByText('Londres')).toBeInTheDocument(); + expect(screen.getByText('Madrid')).toBeInTheDocument(); + expect(screen.getByText('Roma')).toBeInTheDocument(); }); }); diff --git a/webapp/src/components/RegisteredUsers.js b/webapp/src/components/RegisteredUsers.js index ed4347da..d321ea3f 100644 --- a/webapp/src/components/RegisteredUsers.js +++ b/webapp/src/components/RegisteredUsers.js @@ -41,12 +41,18 @@ const RegisteredUsers = () => { - {registeredUsers.map((row, rowIndex) => ( + {/* {registeredUsers.map((row, rowIndex) => ( {row.map((cell, cellIndex) => ( {cell} ))} + ))} */} + {registeredUsers.map((row, rowIndex) => ( + + {row[0]} + {row[1]} + ))} diff --git a/webapp/src/components/RegisteredUsers.test.js b/webapp/src/components/RegisteredUsers.test.js index 824c9fec..9c285aee 100644 --- a/webapp/src/components/RegisteredUsers.test.js +++ b/webapp/src/components/RegisteredUsers.test.js @@ -25,7 +25,6 @@ describe('Registered Users component', () => { await waitFor(() => { - expect(screen.getByText('pablo')).toBeInTheDocument(); expect(screen.getByText('4/23/2024')).toBeInTheDocument(); }); From 9a8ae02ac24cdedd18baeb65f404762dc2d9dfa0 Mon Sep 17 00:00:00 2001 From: baraganio Date: Fri, 26 Apr 2024 20:29:19 +0200 Subject: [PATCH 10/12] =?UTF-8?q?A=C3=B1adidas=202=20nuevas=20consultas=20?= =?UTF-8?q?(habitantes=20y=20numero=20at=C3=B3mico)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- questions/creationservice/creation-service.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/questions/creationservice/creation-service.js b/questions/creationservice/creation-service.js index ca4c1c3a..7c9a70e4 100644 --- a/questions/creationservice/creation-service.js +++ b/questions/creationservice/creation-service.js @@ -22,9 +22,11 @@ var answerOptions = []; var randomQuerySelector; // Array of the possible queries -var queries = ['SELECT DISTINCT ?questionObject ?questionObjectLabel ?answer ?answerLabel WHERE { ?questionObject wdt:P31 wd:Q6256. ?questionObject wdt:P36 ?answer. SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".}}']; +var queries = ['SELECT DISTINCT ?questionObject ?questionObjectLabel ?answer ?answerLabel WHERE { ?questionObject wdt:P31 wd:Q6256. ?questionObject wdt:P36 ?answer. SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".}}', + 'SELECT DISTINCT ?questionObject ?questionObjectLabel ?answer ?answerLabel WHERE { ?questionObject wdt:P31 wd:Q11344; wdt:P1086 ?answer. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".}}', + 'SELECT ?questionObject ?questionObjectLabel ?answer ?answerLabel WHERE { ?questionObject wdt:P31 wd:Q6256; wdt:P1082 ?answer. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".}}']; // Array of the possible questions -var questions = ["¿Cuál es la capital de "]; +var questions = ["¿Cuál es la capital de ","¿Cuál es el número atómico del ", "¿Cuántos habitantes tiene "]; // Recieves the information of the query and select wich data use on the question function getQuestionInfo(info){ From f2757bbba69443b25c7f6641b41a7833fe5ffaf5 Mon Sep 17 00:00:00 2001 From: baraganio Date: Fri, 26 Apr 2024 20:52:42 +0200 Subject: [PATCH 11/12] Arreglando un fallo de userservice test --- users/userservice/user-service.test.js | 34 +++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/users/userservice/user-service.test.js b/users/userservice/user-service.test.js index 2281423c..5c3dbb17 100644 --- a/users/userservice/user-service.test.js +++ b/users/userservice/user-service.test.js @@ -6,6 +6,11 @@ const User = require('./user-model'); let mongoServer; let app; +const user = { + username: 'testuser', + password: 'testpassword', +}; + async function addUser(user){ const hashedPassword = await bcrypt.hash(user.password, 10); const newUser = new User({ @@ -21,6 +26,7 @@ beforeAll(async () => { const mongoUri = mongoServer.getUri(); process.env.MONGODB_URI = mongoUri; app = require('./user-service'); + await addUser(user); }); afterAll(async () => { @@ -29,16 +35,26 @@ afterAll(async () => { }); describe('User Service', () => { + + // + it('should get the registered users on /getregisteredusers', async () => { + + const response = await request(app).get('/getregisteredusers'); + expect(response.status).toBe(200); + expect(response.body.length).toBe(1); + expect(Array.from(response.body[0])[0]).toBe('testuser'); + }); + // it('should add a new user on POST /adduser', async () => { const newUser = { - username: 'testuser', - password: 'testpassword', + username: 'testuser2', + password: 'testpassword2', }; const response = await request(app).post('/adduser').send(newUser); expect(response.status).toBe(200); - expect(response.body).toHaveProperty('username', 'testuser'); + expect(response.body).toHaveProperty('username', 'testuser2'); }); // @@ -52,15 +68,5 @@ describe('User Service', () => { expect(response.body).toHaveProperty( "error" , "Missing required field: username" ); }); - // - it('should get the registered users on /getregisteredusers', async () => { - addUser(user = { - username: 'testuser', - password: 'testpassword', - }); - const response = await request(app).get('/getregisteredusers'); - expect(response.status).toBe(200); - expect(response.body.length).toBe(1); - expect(Array.from(response.body[0])[0]).toBe('testuser'); - }); + }); From d59b5ad95429744fa5d38df7adef808d8b8b5c85 Mon Sep 17 00:00:00 2001 From: uo264915 Date: Fri, 26 Apr 2024 21:09:31 +0200 Subject: [PATCH 12/12] Test HistoricalData y RegisteredUsers --- webapp/src/components/HistoricalData.test.js | 23 +++++-------------- webapp/src/components/RegisteredUsers.js | 1 + webapp/src/components/RegisteredUsers.test.js | 7 +++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/webapp/src/components/HistoricalData.test.js b/webapp/src/components/HistoricalData.test.js index 4e1dc9ec..d5fdf64d 100644 --- a/webapp/src/components/HistoricalData.test.js +++ b/webapp/src/components/HistoricalData.test.js @@ -7,28 +7,17 @@ import { BrowserRouter as Router } from 'react-router-dom'; const mockAxios = new MockAdapter(axios); -describe('HistoricalData', () => { +describe('HistoricalData component', () => { beforeEach(() => { mockAxios.reset(); }); it('muestra la página con el histórico de preguntas generadas', async () => { - mockAxios.onGet("http://localhost:8000/getquestionshistory").reply(200, - [{ question: "¿Cual es la capital de Venezuela?", - correctOption: "Caracas", - incorrectOption1: "Doha", - incorrectOption2: "Barcelona", - incorrectOption3: "Nasáu" - }, - { - question: "¿Cuál es la capital de Francia?", - correctOption: "París", - incorrectOption1: "Londres", - incorrectOption2: "Madrid", - incorrectOption3: "Roma" - } - ]); + const question1 = ['¿Cual es la capital de Venezuela?', 'Caracas', 'Doha', 'Barcelona', 'Nasáu']; + const question2 = ['¿Cual es la capital de Francia?', 'París', 'Londres', 'Madrid', 'Roma']; + const mockUsers = [question1, question2]; + mockAxios.onGet("http://localhost:8000/getquestionshistory").reply(200, mockUsers); render( @@ -42,7 +31,7 @@ describe('HistoricalData', () => { expect(screen.getByText('Barcelona')).toBeInTheDocument(); expect(screen.getByText('Nasáu')).toBeInTheDocument(); - expect(screen.getByText('¿Cuál es la capital de Francia?')).toBeInTheDocument(); + expect(screen.getByText('¿Cual es la capital de Francia?')).toBeInTheDocument(); expect(screen.getByText('París')).toBeInTheDocument(); expect(screen.getByText('Londres')).toBeInTheDocument(); expect(screen.getByText('Madrid')).toBeInTheDocument(); diff --git a/webapp/src/components/RegisteredUsers.js b/webapp/src/components/RegisteredUsers.js index d321ea3f..bc2b6347 100644 --- a/webapp/src/components/RegisteredUsers.js +++ b/webapp/src/components/RegisteredUsers.js @@ -54,6 +54,7 @@ const RegisteredUsers = () => { {row[1]} ))} + diff --git a/webapp/src/components/RegisteredUsers.test.js b/webapp/src/components/RegisteredUsers.test.js index 9c285aee..76e49bde 100644 --- a/webapp/src/components/RegisteredUsers.test.js +++ b/webapp/src/components/RegisteredUsers.test.js @@ -13,10 +13,9 @@ describe('Registered Users component', () => { }); it('muestra todos los usuarios registrados', async () => { - - mockAxios.onGet("http://localhost:8000/RegisteredUsers").reply(200, - [{ username: "pablo", - fecha: "4/23/2024"}]); + const user1 = ['pablo', '4/23/2024']; + const mockUsers = [user1]; + mockAxios.onGet("http://localhost:8000/getregisteredusers").reply(200, mockUsers); render(