31 lines
882 B
TypeScript
31 lines
882 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { TrackTurns } from './TrackTurns';
|
|
|
|
describe('TrackTurns', () => {
|
|
it('should create track turns', () => {
|
|
const turns = TrackTurns.create(10);
|
|
expect(turns.toNumber()).toBe(10);
|
|
expect(turns.props).toBe(10);
|
|
});
|
|
|
|
it('should allow zero turns', () => {
|
|
const turns = TrackTurns.create(0);
|
|
expect(turns.toNumber()).toBe(0);
|
|
});
|
|
|
|
it('should throw for negative turns', () => {
|
|
expect(() => TrackTurns.create(-1)).toThrow('Track turns cannot be negative');
|
|
});
|
|
|
|
it('should equal same turns', () => {
|
|
const t1 = TrackTurns.create(10);
|
|
const t2 = TrackTurns.create(10);
|
|
expect(t1.equals(t2)).toBe(true);
|
|
});
|
|
|
|
it('should not equal different turns', () => {
|
|
const t1 = TrackTurns.create(10);
|
|
const t2 = TrackTurns.create(20);
|
|
expect(t1.equals(t2)).toBe(false);
|
|
});
|
|
}); |