fix issues

This commit is contained in:
2026-01-02 00:21:24 +01:00
parent 79913bb45e
commit 8693dde21e
46 changed files with 1680 additions and 302 deletions

View File

@@ -9,15 +9,17 @@ describe('RatingDelta', () => {
expect(RatingDelta.create(-10).value).toBe(-10);
expect(RatingDelta.create(100).value).toBe(100);
expect(RatingDelta.create(-100).value).toBe(-100);
expect(RatingDelta.create(500).value).toBe(500);
expect(RatingDelta.create(-500).value).toBe(-500);
expect(RatingDelta.create(50.5).value).toBe(50.5);
expect(RatingDelta.create(-50.5).value).toBe(-50.5);
});
it('should throw for values outside range', () => {
expect(() => RatingDelta.create(100.1)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(-100.1)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(101)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(-101)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(500.1)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(-500.1)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(501)).toThrow(IdentityDomainValidationError);
expect(() => RatingDelta.create(-501)).toThrow(IdentityDomainValidationError);
});
it('should accept zero', () => {

View File

@@ -17,9 +17,9 @@ export class RatingDelta implements IValueObject<RatingDeltaProps> {
throw new IdentityDomainValidationError('Rating delta must be a valid number');
}
if (value < -100 || value > 100) {
if (value < -500 || value > 500) {
throw new IdentityDomainValidationError(
`Rating delta must be between -100 and 100, got: ${value}`
`Rating delta must be between -500 and 500, got: ${value}`
);
}