import { ProtestId } from './ProtestId'; import { RacingDomainValidationError } from '../errors/RacingDomainError'; describe('ProtestId', () => { describe('create', () => { it('should create a ProtestId with valid value', () => { const id = ProtestId.create('protest-123'); expect(id.toString()).toBe('protest-123'); }); it('should trim whitespace', () => { const id = ProtestId.create(' protest-123 '); expect(id.toString()).toBe('protest-123'); }); it('should throw error for empty string', () => { expect(() => ProtestId.create('')).toThrow(RacingDomainValidationError); }); it('should throw error for whitespace only', () => { expect(() => ProtestId.create(' ')).toThrow(RacingDomainValidationError); }); }); describe('equals', () => { it('should return true for equal ids', () => { const id1 = ProtestId.create('protest-123'); const id2 = ProtestId.create('protest-123'); expect(id1.equals(id2)).toBe(true); }); it('should return false for different ids', () => { const id1 = ProtestId.create('protest-123'); const id2 = ProtestId.create('protest-456'); expect(id1.equals(id2)).toBe(false); }); }); });