feat(smartversion): add equality comparison methods for SmartVersion instances and version strings

This commit is contained in:
2026-04-07 16:29:20 +00:00
parent d900fa3494
commit ab09d44759
4 changed files with 29 additions and 1 deletions

View File

@@ -33,4 +33,14 @@ tap.test('should create a patch version', async () => {
console.log(newVersion.versionString);
})
tap.test('should compare versions for equality', async () => {
const v1 = new smartversion.SmartVersion('1.2.3');
const v2 = new smartversion.SmartVersion('1.2.3');
const v3 = new smartversion.SmartVersion('1.2.4');
expect(v1.equals(v2)).toBeTrue();
expect(v1.equals(v3)).toBeFalse();
expect(v1.equalsString('1.2.3')).toBeTrue();
expect(v1.equalsString('1.2.4')).toBeFalse();
});
export default tap.start();