import { describe, expect, it } from 'vitest'; import { DriverName } from './DriverName'; describe('DriverName', () => { it('should create a driver name', () => { const name = DriverName.create('John Doe'); expect(name.toString()).toBe('John Doe'); }); it('should trim whitespace', () => { const name = DriverName.create(' John Doe '); expect(name.toString()).toBe('John Doe'); }); it('should throw on empty name', () => { expect(() => DriverName.create('')).toThrow('Driver name is required'); }); it('should throw on whitespace only', () => { expect(() => DriverName.create(' ')).toThrow('Driver name is required'); }); it('should equal same name', () => { const n1 = DriverName.create('John Doe'); const n2 = DriverName.create('John Doe'); expect(n1.equals(n2)).toBe(true); }); it('should not equal different name', () => { const n1 = DriverName.create('John Doe'); const n2 = DriverName.create('Jane Doe'); expect(n1.equals(n2)).toBe(false); }); });