30 lines
810 B
TypeScript
30 lines
810 B
TypeScript
import { describe, expect, it } 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);
|
|
});
|
|
}); |