Skip to content

Commit 8b3a693

Browse files
authored
Merge branch 'development' into lucie/mui-1711-events-js-update
2 parents f5dd4db + 4764802 commit 8b3a693

33 files changed

+257
-133
lines changed

backend/globalConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"mongoUri":"mongodb://127.0.0.1:53806/jest?","mongoDBName":"jest"}
1+
{"mongoUri":"mongodb://127.0.0.1:56074/jest?","mongoDBName":"jest"}

backend/jest-mongodb-config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

backend/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
2-
preset: '@shelf/jest-mongodb',
2+
testEnvironment: 'node',
33
setupFilesAfterEnv: ['./jest.setup.js'],
44
watchPathIgnorePatterns: ['globalConfig'],
5+
testPathIgnorePatterns: ['/test/old-tests/'],
56
};

backend/middleware/user.middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function isAdminByEmail(req, res, next) {
1515
return res.sendStatus(400);
1616
} else {
1717
const role = user.accessLevel;
18-
if (role === 'admin' || user.managedProjects.length > 0) {
18+
if (role === 'admin' || role === 'superadmin' || user.managedProjects.length > 0) {
1919
next();
2020
} else {
2121
next(res.sendStatus(401));

backend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"@babel/core": "^7.15.0",
2020
"@babel/eslint-parser": "^7.15.0",
2121
"@babel/eslint-plugin": "^7.14.5",
22-
"@shelf/jest-mongodb": "^1.2.3",
2322
"concurrently": "^5.1.0",
2423
"debug": "^4.3.1",
2524
"eslint": "^7.9.0",

backend/routers/grantpermission.router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ router.post("/gitHub", async (req, res) => {
7373

7474
const teamSlugs = [baseTeamSlug, managerTeamSlug];
7575

76-
if (accessLevel === "admin") teamSlugs.push(adminTeamSlug);
76+
if (accessLevel === "admin" || accessLevel === "superadmin") teamSlugs.push(adminTeamSlug);
7777

7878
function createSlug(string) {
7979
let slug = string.toLowerCase();

backend/setup-test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@ module.exports = {
5656
await removeAllCollections();
5757
});
5858

59+
// Disconnect Mongoose
60+
afterAll(async () => {
61+
await dropAllCollections();
62+
await mongoose.connection.close();
63+
await mongoServer.stop();
64+
});
65+
},
66+
setupIntegrationDB(databaseName) {
67+
// Connect to Mongoose
68+
beforeAll(async () => {
69+
mongoServer = new MongoMemoryServer({
70+
instance: { dbName: databaseName },
71+
});
72+
const mongoUri = await mongoServer.getUri();
73+
const opts = {
74+
useNewUrlParser: true,
75+
useFindAndModify: false,
76+
useCreateIndex: true,
77+
useUnifiedTopology: true,
78+
};
79+
await mongoose.connect(mongoUri, opts, (err) => {
80+
if (err) console.error(err);
81+
});
82+
});
83+
5984
// Disconnect Mongoose
6085
afterAll(async () => {
6186
await dropAllCollections();
File renamed without changes.

0 commit comments

Comments
 (0)