volleyballsimtypes 0.0.467 → 0.0.469
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.
- package/dist/cjs/src/service/player/injury.d.ts +2 -1
- package/dist/cjs/src/service/player/injury.js +1 -0
- package/dist/cjs/src/service/player/injury.test.js +2 -1
- package/dist/cjs/src/service/player/schemas/player.z.js +1 -1
- package/dist/esm/src/service/player/injury.d.ts +2 -1
- package/dist/esm/src/service/player/injury.js +1 -0
- package/dist/esm/src/service/player/injury.test.js +2 -1
- package/dist/esm/src/service/player/schemas/player.z.js +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ var InjurySeverityEnum;
|
|
|
10
10
|
InjurySeverityEnum[InjurySeverityEnum["MINOR"] = 1] = "MINOR";
|
|
11
11
|
InjurySeverityEnum[InjurySeverityEnum["MODERATE"] = 2] = "MODERATE";
|
|
12
12
|
InjurySeverityEnum[InjurySeverityEnum["SEVERE"] = 3] = "SEVERE";
|
|
13
|
+
InjurySeverityEnum[InjurySeverityEnum["CRITICAL"] = 4] = "CRITICAL";
|
|
13
14
|
})(InjurySeverityEnum || (exports.InjurySeverityEnum = InjurySeverityEnum = {}));
|
|
14
15
|
// A long-term injury is active while `at` is before injuredUntil.
|
|
15
16
|
function hasActiveInjury(injury, at) {
|
|
@@ -26,7 +26,8 @@ const test_helpers_1 = require("../test-helpers");
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
(0, globals_1.it)('rejects out-of-range severity and profile', () => {
|
|
29
|
-
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(
|
|
29
|
+
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(true);
|
|
30
|
+
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 5, injuredUntil: new Date() } }).success).toBe(false);
|
|
30
31
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 0, injuredUntil: new Date() } }).success).toBe(false);
|
|
31
32
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: 1.2 }).success).toBe(false);
|
|
32
33
|
(0, globals_1.expect)(player_z_1.PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: -0.1 }).success).toBe(false);
|
|
@@ -41,7 +41,7 @@ exports.PlayerInputSchema = zod_1.z.object({
|
|
|
41
41
|
// Defaulted so every existing Player.create caller (generator, transformers, test helpers) stays valid.
|
|
42
42
|
injuryProneProfile: zod_1.z.number().min(0).max(1).default(0.5),
|
|
43
43
|
injury: zod_1.z.object({
|
|
44
|
-
severity: zod_1.z.number().int().min(1).max(
|
|
44
|
+
severity: zod_1.z.number().int().min(1).max(4),
|
|
45
45
|
injuredUntil: zod_1.z.coerce.date(),
|
|
46
46
|
debuff: zod_1.z.number().min(0).max(1).optional()
|
|
47
47
|
}).optional(),
|
|
@@ -4,6 +4,7 @@ export var InjurySeverityEnum;
|
|
|
4
4
|
InjurySeverityEnum[InjurySeverityEnum["MINOR"] = 1] = "MINOR";
|
|
5
5
|
InjurySeverityEnum[InjurySeverityEnum["MODERATE"] = 2] = "MODERATE";
|
|
6
6
|
InjurySeverityEnum[InjurySeverityEnum["SEVERE"] = 3] = "SEVERE";
|
|
7
|
+
InjurySeverityEnum[InjurySeverityEnum["CRITICAL"] = 4] = "CRITICAL";
|
|
7
8
|
})(InjurySeverityEnum || (InjurySeverityEnum = {}));
|
|
8
9
|
// A long-term injury is active while `at` is before injuredUntil.
|
|
9
10
|
export function hasActiveInjury(injury, at) {
|
|
@@ -24,7 +24,8 @@ describe('Player injury fields', () => {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
it('rejects out-of-range severity and profile', () => {
|
|
27
|
-
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(
|
|
27
|
+
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 4, injuredUntil: new Date() } }).success).toBe(true);
|
|
28
|
+
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 5, injuredUntil: new Date() } }).success).toBe(false);
|
|
28
29
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injury: { severity: 0, injuredUntil: new Date() } }).success).toBe(false);
|
|
29
30
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: 1.2 }).success).toBe(false);
|
|
30
31
|
expect(PlayerInputSchema.safeParse({ ...validInput(), injuryProneProfile: -0.1 }).success).toBe(false);
|
|
@@ -38,7 +38,7 @@ export const PlayerInputSchema = z.object({
|
|
|
38
38
|
// Defaulted so every existing Player.create caller (generator, transformers, test helpers) stays valid.
|
|
39
39
|
injuryProneProfile: z.number().min(0).max(1).default(0.5),
|
|
40
40
|
injury: z.object({
|
|
41
|
-
severity: z.number().int().min(1).max(
|
|
41
|
+
severity: z.number().int().min(1).max(4),
|
|
42
42
|
injuredUntil: z.coerce.date(),
|
|
43
43
|
debuff: z.number().min(0).max(1).optional()
|
|
44
44
|
}).optional(),
|