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