wip league admin tools
This commit is contained in:
@@ -3,30 +3,34 @@ import { TrackId } from './TrackId';
|
||||
|
||||
describe('TrackId', () => {
|
||||
it('should create track id', () => {
|
||||
const id = TrackId.create('track-123');
|
||||
expect(id.toString()).toBe('track-123');
|
||||
expect(id.props).toBe('track-123');
|
||||
const uuid = '550e8400-e29b-41d4-a716-446655440000';
|
||||
const id = TrackId.create(uuid);
|
||||
expect(id.toString()).toBe(uuid);
|
||||
expect(id.value).toBe(uuid);
|
||||
});
|
||||
|
||||
it('should trim whitespace', () => {
|
||||
const id = TrackId.create(' track-123 ');
|
||||
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 empty id', () => {
|
||||
expect(() => TrackId.create('')).toThrow('Track ID cannot be empty');
|
||||
expect(() => TrackId.create(' ')).toThrow('Track ID cannot be empty');
|
||||
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 i1 = TrackId.create('track-123');
|
||||
const i2 = TrackId.create('track-123');
|
||||
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('track-123');
|
||||
const i2 = TrackId.create('track-456');
|
||||
const i1 = TrackId.create('550e8400-e29b-41d4-a716-446655440000');
|
||||
const i2 = TrackId.create('550e8400-e29b-41d4-a716-446655440001');
|
||||
expect(i1.equals(i2)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user