fix issues
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user