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