backend-test-tools 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,13 +18,13 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
20
|
- name: Checkout
|
|
21
|
-
uses: actions/checkout@
|
|
21
|
+
uses: actions/checkout@v5
|
|
22
22
|
with:
|
|
23
23
|
fetch-depth: 0
|
|
24
24
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
25
25
|
|
|
26
26
|
- name: Setup Node.js
|
|
27
|
-
uses: actions/setup-node@
|
|
27
|
+
uses: actions/setup-node@v5
|
|
28
28
|
with:
|
|
29
29
|
node-version: '22'
|
|
30
30
|
registry-url: 'https://registry.npmjs.org'
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [1.2.5](https://github.com/prakashmahendran/backend-test-tools/compare/v1.2.4...v1.2.5) (2026-11-12)
|
|
2
|
+
|
|
3
|
+
### 🐛 Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deps:** support node-server-engine 2.x ([7cbf9b1](https://github.com/prakashmahendran/backend-test-tools/commit/7cbf9b1d7bdf1ba5507722db9540ed4187eff3f9))
|
|
6
|
+
|
|
7
|
+
## [1.2.4](https://github.com/prakashmahendran/backend-test-tools/compare/v1.2.3...v1.2.4) (2026-11-12)
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ci:** use changelog preset compatible with semantic-release ([ac916dd](https://github.com/prakashmahendran/backend-test-tools/commit/ac916ddc071ab83e90c619f7b842b27ca7e5f45d))
|
|
12
|
+
* **deps:** patch vulnerable dependencies and make engine peer optional ([91f4d5b](https://github.com/prakashmahendran/backend-test-tools/commit/91f4d5bfad66dc343e0e2b200e05e895d6b83c85))
|
|
13
|
+
|
|
14
|
+
### 📚 Documentation
|
|
15
|
+
|
|
16
|
+
* add CLAUDE.md with package overview and conventions ([e75a233](https://github.com/prakashmahendran/backend-test-tools/commit/e75a233c5cac6aa6d8290c85fe04f0f5f9d60fa8))
|
|
17
|
+
|
|
1
18
|
## [1.2.3](https://github.com/prakashmahendran/backend-test-tools/compare/v1.2.2...v1.2.3) (2025-12-10)
|
|
2
19
|
|
|
3
20
|
### 🐛 Bug Fixes
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# backend-test-tools
|
|
2
|
+
|
|
3
|
+
Test helpers (published to npm) for backend services generated from `node-server-template`. Services
|
|
4
|
+
install it as a **devDependency**.
|
|
5
|
+
|
|
6
|
+
- `node-server-engine` is an *optional* peer dependency: the stubs in `src/stubs/server-engine` wrap engine
|
|
7
|
+
classes, so consuming services already have it installed.
|
|
8
|
+
- `node-server-engine` must not depend on this package. The engine keeps its own test helpers to avoid a
|
|
9
|
+
circular dependency.
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
Node.js >= 22.
|
|
14
|
+
|
|
15
|
+
| Task | Command |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Install | `npm ci` |
|
|
18
|
+
| Build to `dist/` (tsc for types + babel for JS) | `npm run build` |
|
|
19
|
+
| Lint | `npm run lint` |
|
|
20
|
+
| Tests | `npm test` (there are currently no test files; verify changes with `npm run build`) |
|
|
21
|
+
|
|
22
|
+
## Layout (`src/`)
|
|
23
|
+
|
|
24
|
+
- `generators/`: `generateAccessToken` (HS256 JWT signed with `JWT_SECRET`, matching the engine's test
|
|
25
|
+
mode), `generateEcdsaKeyPair`, `generateRsaKeyPair`, `generateUserCrypto`, `generateImageBuffer`
|
|
26
|
+
(uses `sharp`), `generateLocale`.
|
|
27
|
+
- `utils/`: `getBearer`, `jwtRequest`/`staticRequest`/`tlsRequest` (supertest wrappers), `mockRequest`
|
|
28
|
+
(Express request/response/next mocks), `generateCerts` (`generatePkiEnvironment`, which uses `node-forge`
|
|
29
|
+
to write a CA plus client/server certificates to `./certs`).
|
|
30
|
+
- `factory/`: `factory.build('user')` / `buildMany` for plain test objects.
|
|
31
|
+
- `stubs/server-engine/`: sinon stubs for engine features (`PubSub`, `PushNotification`, `sendPush`,
|
|
32
|
+
`Localizator`).
|
|
33
|
+
- `index.ts`: public exports.
|
|
34
|
+
|
|
35
|
+
## Conventions
|
|
36
|
+
|
|
37
|
+
- Runtime `dependencies` are what consumers need at test time (`jsonwebtoken`, `node-forge`, `sharp`,
|
|
38
|
+
`sinon`, `supertest`). Build-only tooling goes in `devDependencies`.
|
|
39
|
+
- Never commit generated keys or certificates. `certs/` is created at test time.
|
|
40
|
+
- Conventional commits. Pushing to `main` triggers semantic-release, which publishes to npm.
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.stubSendPush = stubSendPush;
|
|
7
7
|
var sendPush = _interopRequireWildcard(require("node-server-engine/dist/utils/sendPush/sendPush"));
|
|
8
8
|
var _sinon = require("sinon");
|
|
9
|
-
|
|
9
|
+
var cache;
|
|
10
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
10
11
|
/** Stub the sendPush function */
|
|
11
12
|
function stubSendPush() {
|
|
12
13
|
return (0, _sinon.stub)(sendPush, 'sendPush').resolves();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendPush.js","names":["sendPush","_interopRequireWildcard","require","_sinon","e","t","
|
|
1
|
+
{"version":3,"file":"sendPush.js","names":["sendPush","_interopRequireWildcard","require","_sinon","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","stubSendPush","stub","resolves"],"sources":["../../../src/stubs/server-engine/sendPush.ts"],"sourcesContent":["import * as sendPush from 'node-server-engine/dist/utils/sendPush/sendPush';\nimport {SinonStub, stub} from 'sinon';\n\n/** Stub the sendPush function */\nexport function stubSendPush(): SinonStub {\n return stub(sendPush, 'sendPush').resolves();\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsC,IAAAE,KAAA;AAAA,SAAAH,wBAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAE,UAAA,SAAAF,CAAA,MAAAG,CAAA,EAAAC,CAAA,EAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,QAAAM,MAAA,CAAAN,CAAA,MAAAA,CAAA,SAAAQ,CAAA,MAAAT,KAAA,yBAAAY,OAAA,KAAAZ,KAAA,OAAAY,OAAA,KAAAZ,KAAA,QAAAA,KAAA,CAAAa,GAAA,CAAAZ,CAAA,UAAAD,KAAA,CAAAc,GAAA,CAAAb,CAAA,GAAAD,KAAA,CAAAe,GAAA,CAAAd,CAAA,EAAAQ,CAAA,UAAAJ,CAAA,IAAAJ,CAAA,gBAAAI,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAI,CAAA,OAAAD,CAAA,GAAAE,CAAA,IAAAC,MAAA,CAAAW,wBAAA,CAAAjB,CAAA,EAAAI,CAAA,OAAAD,CAAA,CAAAU,GAAA,IAAAV,CAAA,CAAAW,GAAA,IAAAT,CAAA,CAAAG,CAAA,EAAAJ,CAAA,EAAAD,CAAA,IAAAK,CAAA,CAAAJ,CAAA,IAAAJ,CAAA,CAAAI,CAAA,WAAAI,CAAA;AAEtC;AACO,SAASU,YAAYA,CAAA,EAAc;EACxC,OAAO,IAAAC,WAAI,EAACxB,QAAQ,EAAE,UAAU,CAAC,CAACyB,QAAQ,CAAC,CAAC;AAC9C","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-test-tools",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Backend Node test tools",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -29,33 +29,35 @@
|
|
|
29
29
|
"@babel/preset-env": "^7.26.0",
|
|
30
30
|
"@babel/preset-typescript": "^7.26.0",
|
|
31
31
|
"@babel/register": "^7.25.9",
|
|
32
|
-
"@commitlint/cli": "^
|
|
33
|
-
"@commitlint/config-conventional": "^
|
|
32
|
+
"@commitlint/cli": "^21.2.4",
|
|
33
|
+
"@commitlint/config-conventional": "^21.2.4",
|
|
34
34
|
"@eslint/js": "^9.17.0",
|
|
35
|
-
"@faker-js/faker": "^
|
|
36
|
-
"@semantic-release/changelog": "^
|
|
37
|
-
"@semantic-release/git": "^
|
|
35
|
+
"@faker-js/faker": "^10.6.0",
|
|
36
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
37
|
+
"@semantic-release/git": "^11.0.1",
|
|
38
38
|
"@types/chai": "^5.0.1",
|
|
39
|
+
"@types/express": "^5.0.6",
|
|
39
40
|
"@types/jsonwebtoken": "^9.0.7",
|
|
40
41
|
"@types/mocha": "^10.0.10",
|
|
41
42
|
"@types/node": "^22.10.2",
|
|
42
43
|
"@types/node-forge": "^1.3.11",
|
|
43
|
-
"@types/sinon": "^
|
|
44
|
+
"@types/sinon": "^22.0.2",
|
|
44
45
|
"@types/superagent": "^8.1.9",
|
|
45
|
-
"@types/supertest": "^
|
|
46
|
+
"@types/supertest": "^7.2.1",
|
|
46
47
|
"@types/validator": "^13.12.2",
|
|
47
48
|
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
48
49
|
"babel-plugin-istanbul": "^7.0.0",
|
|
49
50
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
50
51
|
"babel-plugin-tsconfig-paths": "^1.0.3",
|
|
51
|
-
"conventional-changelog-conventionalcommits": "^
|
|
52
|
+
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
52
53
|
"core-js": "^3.39.0",
|
|
53
54
|
"eslint": "^9.17.0",
|
|
54
|
-
"globals": "^
|
|
55
|
+
"globals": "^17.14.0",
|
|
55
56
|
"husky": "^9.1.7",
|
|
56
|
-
"lint-staged": "^
|
|
57
|
-
"mocha": "^
|
|
58
|
-
"
|
|
57
|
+
"lint-staged": "^17.6.0",
|
|
58
|
+
"mocha": "^12.0.3",
|
|
59
|
+
"node-server-engine": "^2.0.0",
|
|
60
|
+
"nyc": "^18.0.0",
|
|
59
61
|
"prettier": "^3.4.2",
|
|
60
62
|
"rimraf": "^6.0.1",
|
|
61
63
|
"semantic-release": "^25.0.2",
|
|
@@ -75,14 +77,19 @@
|
|
|
75
77
|
"*.ts": "eslint"
|
|
76
78
|
},
|
|
77
79
|
"peerDependencies": {
|
|
78
|
-
"node-server-engine": "^1.2.6"
|
|
80
|
+
"node-server-engine": "^1.2.6 || ^2.0.0"
|
|
79
81
|
},
|
|
80
82
|
"dependencies": {
|
|
81
|
-
"@babel/runtime": "^7.
|
|
82
|
-
"jsonwebtoken": "^9.0.
|
|
83
|
-
"node-forge": "^1.3
|
|
84
|
-
"sharp": "^0.
|
|
85
|
-
"sinon": "^
|
|
86
|
-
"supertest": "^7.
|
|
83
|
+
"@babel/runtime": "^7.29.14",
|
|
84
|
+
"jsonwebtoken": "^9.0.3",
|
|
85
|
+
"node-forge": "^1.4.3",
|
|
86
|
+
"sharp": "^0.35.5",
|
|
87
|
+
"sinon": "^22.1.0",
|
|
88
|
+
"supertest": "^7.3.2"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"node-server-engine": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
}
|