import { describe, expect, it } from 'vitest'; import { TrackId } from './TrackId'; describe('TrackId', () => { it('should create track id', () => { const uuid = '550e8400-e29b-41d4-a716-446655440000'; const id = TrackId.create(uuid); expect(id.toString()).toBe(uuid); expect(id.value).toBe(uuid); }); it('should allow fromString without validation', () => { const id = TrackId.fromString('track-123'); expect(id.toString()).toBe('track-123'); expect(id.value).toBe('track-123'); }); it('should throw for invalid uuid', () => { expect(() => TrackId.create('')).toThrow('TrackId must be a valid UUID'); expect(() => TrackId.create(' ')).toThrow('TrackId must be a valid UUID'); expect(() => TrackId.create('track-123')).toThrow('TrackId must be a valid UUID'); }); it('should equal same ids', () => { const uuid = '550e8400-e29b-41d4-a716-446655440000'; const i1 = TrackId.create(uuid); const i2 = TrackId.create(uuid); expect(i1.equals(i2)).toBe(true); }); it('should not equal different ids', () => { const i1 = TrackId.create('550e8400-e29b-41d4-a716-446655440000'); const i2 = TrackId.create('550e8400-e29b-41d4-a716-446655440001'); expect(i1.equals(i2)).toBe(false); }); });