Skip to content

Commit 71f2a7d

Browse files
authored
Merge pull request #162 from OWASP/dec-2024-fix-dependencies-and-tests
Dec 2024 - Fix dependencies and tests
2 parents 56f86c3 + 7b00af4 commit 71f2a7d

File tree

7 files changed

+7689
-6158
lines changed

7 files changed

+7689
-6158
lines changed

trainingportal/package-lock.json

Lines changed: 7411 additions & 5902 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

trainingportal/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"url": "[email protected]:trendmicro/SecureCodingDojo.git"
99
},
1010
"scripts": {
11-
"test": "mocha"
11+
"test": "jest"
12+
},
13+
"jest": {
14+
"verbose": true
1215
},
1316
"author": "Paul Ionescu",
1417
"license": "Apache-2.0",
@@ -31,14 +34,14 @@
3134
"highlightjs": "^9.16.2",
3235
"jquery": "^3.6.0",
3336
"markdown": "^0.5.0",
34-
"mysql2": "^1.7.0",
37+
"mysql2": "^3.11.5",
3538
"node-truncate": "^0.1.0",
3639
"open-iconic": "^1.1.1",
3740
"passport": "^0.7.0",
3841
"passport-google-oauth20": "^2.0.0",
3942
"passport-ldapauth": "^2.1.4",
4043
"passport-local": "^1.0.0",
41-
"passport-saml": "^2.2.0",
44+
"passport-saml": "^3.1.2",
4245
"passport-slack": "0.0.7",
4346
"passport-slack-oauth2": "^1.2.0",
4447
"popper": "^1.0.1",
@@ -47,7 +50,6 @@
4750
"validator": "^13.6.0"
4851
},
4952
"devDependencies": {
50-
"chai": "^4.3.4",
51-
"mocha": "^6.2.2"
53+
"jest": "^29.7.0"
5254
}
5355
}
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,25 @@ config.allowedAccountPattern = "authTest.*";
1414
describe('authTests', () => {
1515

1616

17-
before(async () => {
17+
beforeAll(async () => {
1818
await db.getConn().queryPromise("DELETE FROM users WHERE accountId LIKE ?",["authTest%"]);
1919
await db.getConn().queryPromise("DELETE FROM teams WHERE name LIKE ?",["authTest%"]);
2020
});
2121

22-
describe('#processAuthCallback', async () => {
22+
describe('#processAuthCallback', () => {
2323

2424
var teamOwner = null;
2525
var team = null;
2626

27-
before(async () => {
28-
27+
beforeAll(async () => {
2928

3029
await db.getPromise(db.insertUser,{accountId:"authTestTeamOwner",familyName:"Owner", givenName:"Team"});
3130
teamOwner = await db.getPromise(db.getUser,"authTestTeamOwner");
3231
await db.getPromise(db.insertTeam,[teamOwner,{name:"authTestTeam"}]);
3332
team = await db.getPromise(db.getTeamWithMembersByName,"authTestTeam");
3433
});
3534

36-
it('should create a new user without a team', async () => {
35+
test('should create a new user without a team', async () => {
3736
await db.getConn().queryPromise("DELETE FROM users WHERE accountId = ?",["authTestUser"]);
3837

3938
config.defaultTeam = null;
@@ -50,7 +49,7 @@ describe('authTests', () => {
5049
return promise;
5150
});
5251

53-
it('should create a new user and assign it to the default team', async () => {
52+
test('should create a new user and assign it to the default team', async () => {
5453
await db.getConn().queryPromise("DELETE FROM users WHERE accountId = ?",["authTestUser"]);
5554
config.defaultTeam = "authTestTeam";
5655
var promise = new Promise((resolve,reject)=>{
@@ -66,7 +65,7 @@ describe('authTests', () => {
6665
return promise;
6766
});
6867

69-
it('should retrieve and return an existing user', async () => {
68+
test('should retrieve and return an existing user', async () => {
7069
await db.getConn().queryPromise("DELETE FROM users WHERE accountId = ?",["authTestUser"]);
7170
config.defaultTeam = "someOtherTeam";
7271
var promise = new Promise((resolve,reject)=>{
@@ -82,7 +81,7 @@ describe('authTests', () => {
8281
return promise;
8382
});
8483

85-
it('should reject a profileId if is not allowed', async () => {
84+
test('should reject a profileId if is not allowed', async () => {
8685
var promise = new Promise((resolve,reject)=>{
8786
auth.processAuthCallback("userNotMatchingAllowedPattern","A","B","[email protected]", (e, u) => {
8887
resolve(e);
@@ -95,7 +94,7 @@ describe('authTests', () => {
9594
return promise;
9695
});
9796

98-
after(async () => {
97+
afterAll(async () => {
9998
await db.getPromise(db.deleteTeam,[teamOwner,team.id]);
10099
await db.getPromise(db.deleteUser,"authTestNewUser");
101100
await db.getPromise(db.deleteUser,"authTestTeamOwner");
@@ -105,7 +104,7 @@ describe('authTests', () => {
105104
});
106105

107106

108-
after(async()=>{
107+
afterAll(async () => {
109108
//cleanup
110109
await db.getConn().queryPromise("DELETE FROM users WHERE accountId LIKE ?",["authTest%"]);
111110
await db.getConn().queryPromise("DELETE FROM teams WHERE name LIKE ?",["authTest%"]);

0 commit comments

Comments
 (0)