This commit is contained in:
2025-12-17 00:33:13 +01:00
parent 8c67081953
commit f01e01e50c
186 changed files with 9242 additions and 1342 deletions

View File

@@ -0,0 +1,37 @@
import { PenaltyValue } from './PenaltyValue';
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
describe('PenaltyValue', () => {
describe('create', () => {
it('should create a PenaltyValue with positive integer', () => {
const value = PenaltyValue.create(5);
expect(value.toNumber()).toBe(5);
});
it('should throw error for zero', () => {
expect(() => PenaltyValue.create(0)).toThrow(RacingDomainValidationError);
});
it('should throw error for negative number', () => {
expect(() => PenaltyValue.create(-1)).toThrow(RacingDomainValidationError);
});
it('should throw error for non-integer', () => {
expect(() => PenaltyValue.create(5.5)).toThrow(RacingDomainValidationError);
});
});
describe('equals', () => {
it('should return true for equal values', () => {
const value1 = PenaltyValue.create(5);
const value2 = PenaltyValue.create(5);
expect(value1.equals(value2)).toBe(true);
});
it('should return false for different values', () => {
const value1 = PenaltyValue.create(5);
const value2 = PenaltyValue.create(10);
expect(value1.equals(value2)).toBe(false);
});
});
});