Files
gridpilot.gg/core/racing/domain/entities/championship/ResultsCount.test.ts
2026-01-16 19:46:49 +01:00

34 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { ResultsCount } from './ResultsCount';
describe('ResultsCount', () => {
it('should create results count', () => {
const count = ResultsCount.create(5);
expect(count.toNumber()).toBe(5);
});
it('should create zero results count', () => {
const count = ResultsCount.create(0);
expect(count.toNumber()).toBe(0);
});
it('should not create negative results count', () => {
expect(() => ResultsCount.create(-1)).toThrow('Results count must be a non-negative integer');
});
it('should not create non-integer results count', () => {
expect(() => ResultsCount.create(1.5)).toThrow('Results count must be a non-negative integer');
});
it('should equal same count', () => {
const c1 = ResultsCount.create(3);
const c2 = ResultsCount.create(3);
expect(c1.equals(c2)).toBe(true);
});
it('should not equal different count', () => {
const c1 = ResultsCount.create(3);
const c2 = ResultsCount.create(4);
expect(c1.equals(c2)).toBe(false);
});
});