import { PenaltyNotes } from './PenaltyNotes'; import { RacingDomainValidationError } from '../../errors/RacingDomainError'; describe('PenaltyNotes', () => { describe('create', () => { it('should create a PenaltyNotes with valid value', () => { const notes = PenaltyNotes.create('Additional notes'); expect(notes.toString()).toBe('Additional notes'); }); it('should trim whitespace', () => { const notes = PenaltyNotes.create(' Additional notes '); expect(notes.toString()).toBe('Additional notes'); }); it('should throw error for empty string', () => { expect(() => PenaltyNotes.create('')).toThrow(RacingDomainValidationError); }); it('should throw error for whitespace only', () => { expect(() => PenaltyNotes.create(' ')).toThrow(RacingDomainValidationError); }); }); describe('equals', () => { it('should return true for equal notes', () => { const notes1 = PenaltyNotes.create('Note'); const notes2 = PenaltyNotes.create('Note'); expect(notes1.equals(notes2)).toBe(true); }); it('should return false for different notes', () => { const notes1 = PenaltyNotes.create('Note1'); const notes2 = PenaltyNotes.create('Note2'); expect(notes1.equals(notes2)).toBe(false); }); }); });