This commit is contained in:
2025-12-17 00:33:13 +01:00
parent 8c67081953
commit f01e01e50c
186 changed files with 9242 additions and 1342 deletions

View File

@@ -0,0 +1,33 @@
import { describe, it, expect } from 'vitest';
import { Position } from './Position';
describe('Position', () => {
it('should create position', () => {
const position = Position.create(1);
expect(position.toNumber()).toBe(1);
});
it('should not create zero position', () => {
expect(() => Position.create(0)).toThrow('Position must be a positive integer');
});
it('should not create negative position', () => {
expect(() => Position.create(-1)).toThrow('Position must be a positive integer');
});
it('should not create non-integer position', () => {
expect(() => Position.create(1.5)).toThrow('Position must be a positive integer');
});
it('should equal same position', () => {
const p1 = Position.create(2);
const p2 = Position.create(2);
expect(p1.equals(p2)).toBe(true);
});
it('should not equal different position', () => {
const p1 = Position.create(2);
const p2 = Position.create(3);
expect(p1.equals(p2)).toBe(false);
});
});