From 7020f11c984e3b5dad8ae33ef19c19b6ef570ecb Mon Sep 17 00:00:00 2001 From: iyanfdezz Date: Thu, 25 Apr 2024 20:04:07 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adiendo=20el=20usuario=20a=20la=20bd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/e2e/test-environment-setup.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/webapp/e2e/test-environment-setup.js b/webapp/e2e/test-environment-setup.js index c17b5fd5..ce3be1a8 100644 --- a/webapp/e2e/test-environment-setup.js +++ b/webapp/e2e/test-environment-setup.js @@ -16,6 +16,17 @@ async function startServer() { statsservice = await require("../../statsservice/stats-service"); authservice = await require("../../users/authservice/auth-service"); gatewayservice = await require("../../gatewayservice/gateway-service"); + + await mongoose.connect(mongoUri); + const existingUser = await User.findOne({ username: "testuser" }); + if (!existingUser) { + const pass = await bcrypt.hash("Testpassword1", 10); + const newUser = new User({ + username: "testuser", + password: pass, + }); + await newUser.save(); + } } startServer();