import { describe, expect, it } from 'vitest'; import { CarId } from './CarId'; describe('CarId', () => { it('should create a car id', () => { const id = CarId.create('car1'); expect(id.toString()).toBe('car1'); }); it('should throw on empty id', () => { expect(() => CarId.create('')).toThrow('Car ID cannot be empty'); }); it('should throw on whitespace id', () => { expect(() => CarId.create(' ')).toThrow('Car ID cannot be empty'); }); it('should trim whitespace', () => { const id = CarId.create(' car1 '); expect(id.toString()).toBe('car1'); }); it('should equal same id', () => { const id1 = CarId.create('car1'); const id2 = CarId.create('car1'); expect(id1.equals(id2)).toBe(true); }); it('should not equal different id', () => { const id1 = CarId.create('car1'); const id2 = CarId.create('car2'); expect(id1.equals(id2)).toBe(false); }); });