Skip to content

Commit 04a4e7d

Browse files
Merge pull request #1967 from Real-Dev-Squad/develop
Dev to Main Sync
2 parents 51090af + cfeb710 commit 04a4e7d

File tree

69 files changed

+3686
-3140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3686
-3140
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [18.x]
18+
node-version: [20.x]
1919

2020
steps:
2121
- uses: actions/checkout@v3

package.json

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,71 @@
1616
"tdd:watch": "sh scripts/tests/tdd.sh"
1717
},
1818
"dependencies": {
19-
"axios": "^1.0.0",
20-
"cloudinary": "^1.25.1",
21-
"config": "^3.3.6",
22-
"cookie-parser": "~1.4.5",
19+
"axios": "^1.6.7",
20+
"cloudinary": "^2.0.3",
21+
"config": "3.3.7",
22+
"cookie-parser": "~1.4.6",
2323
"cors": "^2.8.5",
24-
"datauri": "^4.0.0",
25-
"debug": "~4.3.1",
26-
"express": "~4.18.0",
24+
"datauri": "^4.1.0",
25+
"debug": "~4.3.4",
26+
"express": "~4.18.3",
2727
"express-boom": "^3.0.0",
28-
"firebase-admin": "^11.0.0",
29-
"helmet": "^6.0.0",
28+
"firebase-admin": "^11.11.1",
29+
"helmet": "^7.1.0",
3030
"http-errors": "~2.0.0",
31-
"joi": "^17.4.0",
32-
"jsdoc": "^4.0.0",
31+
"joi": "^17.12.2",
32+
"jsdoc": "^4.0.2",
3333
"jsonwebtoken": "^8.5.1",
3434
"morgan": "~1.10.0",
3535
"multer": "^1.4.2",
36-
"newrelic": "^9.0.0",
37-
"passport": "^0.6.0",
36+
"newrelic": "^11.12.0",
37+
"passport": "^0.7.0",
3838
"passport-github2": "^0.1.12",
39-
"rate-limiter-flexible": "^2.4.1",
40-
"winston": "^3.3.3"
39+
"rate-limiter-flexible": "^5.0.0",
40+
"winston": "^3.12.0"
4141
},
4242
"devDependencies": {
43-
"@types/chai": "^4.3.5",
43+
"@types/chai": "^4.3.12",
4444
"@types/config": "^3.3.3",
45-
"@types/express": "^4.17.17",
46-
"@types/jest": "^29.5.3",
47-
"@types/mocha": "^10.0.1",
48-
"@types/node": "^20.4.3",
45+
"@types/express": "^4.17.21",
46+
"@types/jest": "^29.5.12",
47+
"@types/mocha": "^10.0.6",
48+
"@types/node": "^20.11.24",
4949
"@types/sinon": "^17.0.3",
50-
"@typescript-eslint/parser": "^6.1.0",
51-
"chai": "^4.3.7",
52-
"chai-http": "^4.3.0",
50+
"@typescript-eslint/parser": "^7.1.1",
51+
"chai": "^4.4.1",
52+
"chai-http": "^4.4.0",
5353
"cross-env": "^7.0.3",
54-
"eslint": "^8.0.0",
55-
"eslint-config-prettier": "^8.3.0",
56-
"eslint-config-standard": "^16.0.2",
54+
"eslint": "^8.57.0",
55+
"eslint-config-prettier": "^9.1.0",
56+
"eslint-config-standard": "^16.0.3",
5757
"eslint-plugin-import": "^2.22.1",
5858
"eslint-plugin-mocha": "^10.0.0",
5959
"eslint-plugin-node": "^11.1.0",
60-
"eslint-plugin-prettier": "^4.0.0",
60+
"eslint-plugin-prettier": "^4.2.1",
6161
"eslint-plugin-promise": "^6.0.0",
62-
"eslint-plugin-security": "^1.4.0",
62+
"eslint-plugin-security": "^1.7.1",
6363
"eslint-plugin-standard": "^4.1.0",
64-
"firebase-tools": "^11.28.0",
65-
"mocha": "^10.2.0",
66-
"nock": "^13.0.11",
67-
"nodemon": "^2.0.7",
64+
"firebase-tools": "^13.4.0",
65+
"mocha": "^10.3.0",
66+
"nock": "~13.2.9",
67+
"nodemon": "^3.1.0",
6868
"nyc": "^15.1.0",
6969
"pre-commit": "^1.2.2",
7070
"prettier": "^2.5.1",
71-
"sinon": "^15.0.0",
72-
"ts-node": "^10.9.1",
71+
"sinon": "^17.0.1",
72+
"ts-node": "^10.9.2",
7373
"ts-node-dev": "^2.0.0",
74-
"typescript": "^5.1.6"
74+
"typescript": "~5.3.3"
7575
},
7676
"engines": {
77-
"node": "18.x"
77+
"node": "20.x"
7878
},
7979
"pre-commit": [
8080
"lint"
8181
],
8282
"volta": {
83-
"node": "18.15.0",
84-
"yarn": "1.22.19"
83+
"node": "20.11.1",
84+
"yarn": "1.22.21"
8585
}
8686
}

scripts/tests/testIntegration.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# set 'test' environment
44
export NODE_ENV='test'
5+
export NODE_CONFIG_DIR='./test/config'
56

67
# get project_id value from firestore config
78
json=$(node -e "console.log(require('config').get('firestore'))")

scripts/tests/testUnit.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# set 'test' environment
44
export NODE_ENV='test'
5+
export NODE_CONFIG_DIR='./test/config'
56

67
# get project_id value from firestore config
78
json=$(node -e "console.log(require('config').get('firestore'))")

config/test.js renamed to test/config/test.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@
44
*/
55

66
const port = 3000;
7-
7+
const NODE_ENV = process.env.NODE_ENV;
88
module.exports = {
9+
port: 3000,
910
enableFileLogs: false,
1011
// Console logs are set to avoid the winston error of no defined transports
1112
enableConsoleLogs: true,
1213
discordUnverifiedRoleId: "1234567890",
1314
discordDeveloperRoleId: "9876543210",
1415
discordNewComersChannelId: "709080951824842783",
1516
discordMavenRoleId: "1212121212",
17+
discordMissedUpdatesRoleId: "<discordMissedUpdatesRoleId>",
18+
githubApi: {
19+
baseUrl: "https://api.github.com",
20+
org: "Real-Dev-Squad",
21+
},
1622
githubOauth: {
1723
clientId: "clientId",
1824
clientSecret: "clientSecret",
@@ -33,6 +39,17 @@ module.exports = {
3339
rdsApi: {
3440
baseUrl: `http://localhost:${port}`,
3541
},
42+
rdsUi: {
43+
baseUrl: "https://realdevsquad.com",
44+
routes: {
45+
authRedirection: "/goto",
46+
},
47+
goalAPI: {
48+
baseUrl: "<goalBaseUrl>",
49+
secretKey: "<goalSecretKey>",
50+
cookieName: `goals-session-test`,
51+
},
52+
},
3653
discordBot: {
3754
baseUrl: "DISCORD_BASE_URL",
3855
},
@@ -48,6 +65,10 @@ module.exports = {
4865
},
4966

5067
userToken: {
68+
cookieName: `rds-session-${NODE_ENV}`,
69+
cookieV2Name: `rds-session-v2-${NODE_ENV}`,
70+
ttl: 30 * 24 * 60 * 60, // in seconds
71+
refreshTtl: 180 * 24 * 60 * 60, // in seconds
5172
publicKey:
5273
"-----BEGIN PUBLIC KEY-----\n" +
5374
"MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHo6sGbw8qk+XU9sBVa4w2aEq01i\n" +
@@ -197,6 +218,33 @@ module.exports = {
197218
"-----END PUBLIC KEY-----",
198219
},
199220

221+
// Cloudinary keys
222+
cloudinary: {
223+
cloud_name: "Cloud_name",
224+
api_key: "API_KEY",
225+
api_secret: "api_secret_key",
226+
},
227+
228+
// Cloudflare
229+
cloudflare: {
230+
CLOUDFLARE_ZONE_ID: "Cloudflare_Zone_ID_or_ID",
231+
CLOUDFLARE_X_AUTH_KEY: "Cloudflare_API_Auth_Key",
232+
CLOUDFLARE_X_AUTH_EMAIL: "Cloudflare_User_Email",
233+
},
234+
235+
integrations: {
236+
newrelic: {
237+
appName: "RDS_API_production",
238+
licenseKey: "<newrelicLicenseKey>",
239+
},
240+
},
241+
242+
routesCacheTTL: {
243+
"/members": 900,
244+
},
245+
246+
githubAccessToken: "GITHUB_PERSONAL_ACCESS_TOKEN",
247+
200248
Event100ms: {
201249
APP_ACCESS_KEY: "EVENT_100MS_APP_ACCESS_KEY",
202250
APP_SECRET: "EVENT_100MS_APP_SECRET",

test/integration/arts.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe("Arts", function () {
4747
return done();
4848
});
4949
});
50+
5051
it("Should return 401, for Unauthenticated User", function (done) {
5152
chai
5253
.request(app)
@@ -111,6 +112,7 @@ describe("Arts", function () {
111112
return done();
112113
});
113114
});
115+
114116
it("Should return 401, for Unauthenticated User", function (done) {
115117
chai
116118
.request(app)

test/integration/auth.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe("auth", function () {
5151
expect(res).to.have.status(302);
5252
expect(res.headers.location).to.equal(githubOauthURL);
5353
});
54+
5455
it("should redirect the user to new sign up flow if they are have incomplete user details true", async function () {
5556
const redirectURL = "https://my.realdevsquad.com/new-signup";
5657

test/integration/authorizeRoles.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ describe("authorizeRoles", function () {
182182
return done();
183183
});
184184
});
185+
185186
it("should return server error for super user on route with invalid required role", function (done) {
186187
chai
187188
.request(app)
@@ -195,6 +196,7 @@ describe("authorizeRoles", function () {
195196
return done();
196197
});
197198
});
199+
198200
it("should return server error for app owner on route with invalid required role", function (done) {
199201
chai
200202
.request(app)

test/integration/contributions.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ describe("Contributions", function () {
5858
task.isNoteworthy = false;
5959
await testModel.updateTask(task);
6060
});
61+
6162
afterEach(function () {
6263
sinon.restore();
6364
});
65+
6466
describe("GET /contributions/{username}", function () {
6567
it("Should get all the contributions of the user", function (done) {
6668
sinon.stub(githubService, "fetchPRsByUser").returns(githubPRInfo.prakash);
@@ -104,6 +106,7 @@ describe("Contributions", function () {
104106
return done();
105107
});
106108
});
109+
107110
it("Should respond 404 for unregistered user", function (done) {
108111
chai
109112
.request(app)
@@ -118,6 +121,7 @@ describe("Contributions", function () {
118121
return done();
119122
});
120123
});
124+
121125
it("Should respond empty object when user has no pr and task available", function (done) {
122126
sinon.stub(githubService, "fetchPRsByUser").returns(githubPRInfo.userWithNoPrs);
123127
chai

test/integration/discord.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ describe("test discord actions", function () {
8888
];
8989
await Promise.all(addGroupRolesPromises);
9090
});
91+
9192
afterEach(async function () {
9293
await cleanDb();
9394
});

0 commit comments

Comments
 (0)