diff --git a/controllers/users.js b/controllers/users.js index 62f3d8631..1fa81c282 100644 --- a/controllers/users.js +++ b/controllers/users.js @@ -116,20 +116,16 @@ const getUsers = async (req, res) => { const profile = req.query.profile === "true"; if (profile) { - if (dev) { - if (!req.userData.id) { - return res.boom.badRequest("User ID not provided."); - } + if (!req.userData.id) { + return res.boom.badRequest("User ID not provided."); + } - try { - const result = await dataAccess.retrieveUsers({ id: req.userData.id }); - return res.send(result.user); - } catch (error) { - logger.error(`Error while fetching user: ${error}`); - return res.boom.serverUnavailable(INTERNAL_SERVER_ERROR); - } - } else { - return res.boom.badRequest("Route not found"); + try { + const result = await dataAccess.retrieveUsers({ id: req.userData.id }); + return res.send(result.user); + } catch (error) { + logger.error(`Error while fetching user: ${error}`); + return res.boom.serverUnavailable(INTERNAL_SERVER_ERROR); } } diff --git a/test/integration/users.test.js b/test/integration/users.test.js index 103cb8348..708b87d2f 100644 --- a/test/integration/users.test.js +++ b/test/integration/users.test.js @@ -904,10 +904,10 @@ describe("Users", function () { }); }); - it("Should return the logged-in user's details when profile and dev is true", function (done) { + it("Should return the logged-in user's details when profile is true", function (done) { chai .request(app) - .get("/users?profile=true&dev=true") + .get("/users?profile=true") .set("cookie", `${cookieName}=${jwt}`) .end((err, res) => { if (err) { @@ -923,26 +923,10 @@ describe("Users", function () { }); }); - it("Should throw an error when there is no feature flag given", function (done) { - chai - .request(app) - .get("/users?profile=true") - .set("cookie", `${cookieName}=${jwt}`) - .end((err, res) => { - if (err) { - return done(err); - } - expect(res).to.have.status(400); - expect(res.body).to.be.an("object"); - expect(res.body.message).to.equal("Route not found"); - return done(); - }); - }); - it("Should return 401 if not logged in", function (done) { chai .request(app) - .get("/users?profile=true&dev=true") + .get("/users?profile=true") .set("cookie", `${cookieName}=invalid_token`) .end((err, res) => { if (err) {