Skip to content

Commit fde7159

Browse files
committed
test: add e2e and unit test suite
- Add comprehensive e2e tests against real GSoC 2025 dataset (251 contributors) - Add unit tests for API, Util, and refresh modules - Test all HTTP endpoints: /data, /config, /log, /stats, /rank, /contributor, /login, /setStartDate, /setInterval, /setIncludedRepositories, /remove - Validate cross-endpoint consistency, invalid JSON handling, unknown routes - Fixture-based test isolation using temp directories and env-var overrides - Add npm test script (installs server deps before running tests) - Requires Node.js 18+
1 parent 41b6731 commit fde7159

15 files changed

Lines changed: 5639 additions & 0 deletions

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"start": "npm run build && NODE_ENV=development webpack-dev-server --host 0.0.0.0 --open --hot --config build/webpack.config.js",
3030
"build": "npm --prefix admin run build && NODE_ENV=production webpack --config build/webpack.config.js",
3131
"serve": "cd src/server && NODE_ENV=development node app.js",
32+
"test": "npm --prefix src/server install && node --test 'tests/**/*.test.js'",
3233
"lint": "eslint ."
3334
},
3435
"husky": {

tests/e2e/fixtures/admindata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"username":"dhairyashiil","avatarUrl":"https://avatars.githubusercontent.com/u/93669429?v=4"}]

tests/e2e/fixtures/config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"organization": "RocketChat",
3+
"organizationHomepage": "https://rocket.chat/",
4+
"organizationGithubUrl": "https://github.com/RocketChat",
5+
"authToken": "fake-token-for-e2e",
6+
"adminPassword": "e2e-test-pwd",
7+
"delay": "10",
8+
"serverPort": "63111",
9+
"startDate": "2024-12-01",
10+
"contributors": ["dhairyashiil"],
11+
"includedRepositories": ["Rocket.Chat"]
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

tests/e2e/fixtures/data.json

Lines changed: 2512 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)