ballrush-core 0.2.3 → 0.2.4

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.
@@ -9,8 +9,11 @@ class User {
9
9
  this.language = language;
10
10
  }
11
11
  static create(params) {
12
- if (!params.firstName || !params.userId) {
13
- throw new Error("User must have a first name and userId");
12
+ if (!params.userId) {
13
+ throw new Error(`User creation failed: missing userId (firstName="${params.firstName ?? 'N/A'}")`);
14
+ }
15
+ if (!params.firstName) {
16
+ throw new Error(`User creation failed: missing firstName (userId=${params.userId ?? 'N/A'})`);
14
17
  }
15
18
  return new User(params.userId, params.firstName, params.username, params.language ?? "ru");
16
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ballrush-core",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -13,6 +13,9 @@
13
13
  "scripts": {
14
14
  "build": "tsc -p tsconfig.json",
15
15
  "clean": "rimraf dist",
16
+ "test": "jest",
17
+ "test:watch": "jest --watch",
18
+ "test:cov": "jest --coverage",
16
19
  "pack:check": "npm pack --dry-run",
17
20
  "prepublishOnly": "npm run clean && npm run build && npm run pack:check",
18
21
  "release:patch": "./release.sh patch",
@@ -24,9 +27,13 @@
24
27
  "mongoose": "^7.0.0 || ^8.0.0"
25
28
  },
26
29
  "devDependencies": {
27
- "typescript": "^5.9.0",
30
+ "@types/jest": "^30.0.0",
31
+ "jest": "^30.1.3",
32
+ "mongoose": "^7.8.7",
28
33
  "rimraf": "^5.0.0",
29
- "mongoose": "^7.8.7"
34
+ "ts-jest": "^29.4.4",
35
+ "ts-node": "^10.9.2",
36
+ "typescript": "^5.9.2"
30
37
  },
31
38
  "publishConfig": {
32
39
  "access": "public"