Skip to content

Commit 60a61ef

Browse files
test: add stable leaderboard regression coverage (#128)
Add test that verifies leaderboard operation with data from actual historical leaderboard and fetched github stats
1 parent 2efa98a commit 60a61ef

5 files changed

Lines changed: 1019 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
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-
"lint": "eslint ."
32+
"lint": "eslint .",
33+
"test": "node --test \"test/**/*.test.js\""
3334
},
3435
"husky": {
3536
"hooks": {

test/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Regression tests
2+
3+
This directory holds automated regression tests for stable leaderboard behavior.
4+
5+
`leaderboard-e2e.test.js` starts the current server code against a fixed Rocket.Chat snapshot and verifies that `/stats`, `/rank`, and selected `/contributor` and `/rank?username=` responses still match the checked-in expected output.
6+
7+
Node version used:
8+
9+
- Node.js `v25.4.0`
10+
11+
Fixtures:
12+
13+
- `../contrib/rocketchat/gsoc/2025/gsoc2025final.json` is the canonical snapshot used as the fixed leaderboard input.
14+
- `fixtures/gsoc2025final.expected.json` is the checked-in golden output generated from the current stable ranking logic and used for regression comparisons.
15+
16+
Run from the repo root:
17+
18+
```bash
19+
npm i
20+
npm --prefix src/server install
21+
npm test
22+
```
23+
24+
Note: `npm i` at the repo root installs only root dependencies. The regression test boots `src/server/app.js`, so `src/server` dependencies must also be installed before running `npm test`.
25+
26+
The test itself uses the env/path override support already available in the upstream dotenv-based server setup (`CONFIG_PATH`, `DATA_PATH`, `LOG_PATH`, `ADMINDATA_PATH`, `CONFIG_BACKUP_PATH`, `SERVER_PORT`) and does not require additional source changes under `src/server`.
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": "",
6+
"adminPassword": "123456",
7+
"delay": "10",
8+
"serverPort": "62050",
9+
"contributors": [],
10+
"startDate": "2024-12-01",
11+
"includedRepositories": []
12+
}

0 commit comments

Comments
 (0)