34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { describe, it, expect } 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);
|
|
});
|
|
}); |