From 381f23e42b65f53b59905d7f5d0ccf591308884a Mon Sep 17 00:00:00 2001 From: CANCI0 Date: Sun, 7 Apr 2024 23:40:03 +0200 Subject: [PATCH] Fallos de seguridad arreglados --- users/userservice/user-service.test.js | 6 ++++-- webapp/src/components/Register/Register.test.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/users/userservice/user-service.test.js b/users/userservice/user-service.test.js index 0f3c15cc..57a69669 100644 --- a/users/userservice/user-service.test.js +++ b/users/userservice/user-service.test.js @@ -5,6 +5,8 @@ const { User } = require("./user-model"); let mongoServer; let app; +const password = "testpassword"; + beforeAll(async () => { mongoServer = await MongoMemoryServer.create(); const mongoUri = mongoServer.getUri(); @@ -21,7 +23,7 @@ describe("User Service", () => { it("should add a new user on POST /adduser", async () => { const newUser = { username: "testuser", - password: "testpassword", + password: password, }; const response = await request(app).post("/adduser").send(newUser); @@ -44,7 +46,7 @@ describe("User Service", () => { it("should add a new user on POST /adduser", async () => { const newUser = { username: "testuser", - password: "testpassword", + password: password, }; await request(app).post("/adduser").send(newUser); diff --git a/webapp/src/components/Register/Register.test.js b/webapp/src/components/Register/Register.test.js index 3f33043f..37b0f33f 100644 --- a/webapp/src/components/Register/Register.test.js +++ b/webapp/src/components/Register/Register.test.js @@ -78,7 +78,7 @@ describe("Register Component", () => { ).toBeInTheDocument(); expect(axios.post).toHaveBeenCalledWith(`${apiEndpoint}/adduser`, { username: "testUser", - password: "testPassword", + password: password, }); }); @@ -101,7 +101,7 @@ describe("Register Component", () => { ).toBeInTheDocument(); expect(axios.post).toHaveBeenCalledWith(`${apiEndpoint}/adduser`, { username: "testUser", - password: "testPassword", + password: password, }); });