import { describe, expect, it } from 'vitest'; import { compareVersions, isHigherVersion } from './version'; describe('compareVersions', () => { it('orders by major, then minor, then patch', () => { expect(compareVersions('1.0.0', '2.0.0')).toBe(-1); expect(compareVersions('1.2.0', '1.1.9')).toBe(1); expect(compareVersions('1.0.10', '1.0.9')).toBe(1); expect(compareVersions('1.2.3', '1.2.3')).toBe(0); }); }); describe('isHigherVersion', () => { it('is true only for a strictly greater version', () => { expect(isHigherVersion('1.0.1', '1.0.0')).toBe(true); expect(isHigherVersion('1.0.0', '1.0.0')).toBe(false); expect(isHigherVersion('0.9.0', '1.0.0')).toBe(false); }); });