refactor
This commit is contained in:
31
core/racing/domain/value-objects/TrackTurns.test.ts
Normal file
31
core/racing/domain/value-objects/TrackTurns.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, it, expect } 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user