32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { TrackShortName } from './TrackShortName';
|
|
|
|
describe('TrackShortName', () => {
|
|
it('should create track short name', () => {
|
|
const name = TrackShortName.create('SIL');
|
|
expect(name.toString()).toBe('SIL');
|
|
expect(name.props).toBe('SIL');
|
|
});
|
|
|
|
it('should trim whitespace', () => {
|
|
const name = TrackShortName.create(' SIL ');
|
|
expect(name.toString()).toBe('SIL');
|
|
});
|
|
|
|
it('should throw for empty name', () => {
|
|
expect(() => TrackShortName.create('')).toThrow('Track short name is required');
|
|
expect(() => TrackShortName.create(' ')).toThrow('Track short name is required');
|
|
});
|
|
|
|
it('should equal same names', () => {
|
|
const n1 = TrackShortName.create('SIL');
|
|
const n2 = TrackShortName.create('SIL');
|
|
expect(n1.equals(n2)).toBe(true);
|
|
});
|
|
|
|
it('should not equal different names', () => {
|
|
const n1 = TrackShortName.create('SIL');
|
|
const n2 = TrackShortName.create('MON');
|
|
expect(n1.equals(n2)).toBe(false);
|
|
});
|
|
}); |