refactor
This commit is contained in:
30
core/racing/domain/value-objects/Points.test.ts
Normal file
30
core/racing/domain/value-objects/Points.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Points } from './Points';
|
||||
|
||||
describe('Points', () => {
|
||||
it('should create points', () => {
|
||||
const points = Points.create(100);
|
||||
expect(points.toNumber()).toBe(100);
|
||||
});
|
||||
|
||||
it('should create zero points', () => {
|
||||
const points = Points.create(0);
|
||||
expect(points.toNumber()).toBe(0);
|
||||
});
|
||||
|
||||
it('should not create negative points', () => {
|
||||
expect(() => Points.create(-1)).toThrow('Points cannot be negative');
|
||||
});
|
||||
|
||||
it('should equal same points', () => {
|
||||
const p1 = Points.create(50);
|
||||
const p2 = Points.create(50);
|
||||
expect(p1.equals(p2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should not equal different points', () => {
|
||||
const p1 = Points.create(50);
|
||||
const p2 = Points.create(51);
|
||||
expect(p1.equals(p2)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user