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, }); });