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,38 @@
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);
});
});
});