fix: fix range regexp to handle version with multiple digits

This commit is contained in:
Pierre Vanduynslager
2018-12-16 19:05:08 -05:00
parent 89663d3fcf
commit 9a04e64fab
2 changed files with 14 additions and 2 deletions
+12
View File
@@ -70,18 +70,30 @@ test('isMaintenanceRange', t => {
test('getUpperBound', t => {
t.is(getUpperBound('1.x.x'), '2.0.0');
t.is(getUpperBound('1.X.X'), '2.0.0');
t.is(getUpperBound('10.x.x'), '11.0.0');
t.is(getUpperBound('1.x'), '2.0.0');
t.is(getUpperBound('10.x'), '11.0.0');
t.is(getUpperBound('1.0.x'), '1.1.0');
t.is(getUpperBound('10.0.x'), '10.1.0');
t.is(getUpperBound('10.10.x'), '10.11.0');
t.is(getUpperBound('1.0.0'), '1.0.0');
t.is(getUpperBound('10.0.0'), '10.0.0');
t.is(getUpperBound('foo'), undefined);
});
test('getLowerBound', t => {
t.is(getLowerBound('1.x.x'), '1.0.0');
t.is(getLowerBound('1.X.X'), '1.0.0');
t.is(getLowerBound('10.x.x'), '10.0.0');
t.is(getLowerBound('1.x'), '1.0.0');
t.is(getLowerBound('10.x'), '10.0.0');
t.is(getLowerBound('1.0.x'), '1.0.0');
t.is(getLowerBound('10.0.x'), '10.0.0');
t.is(getLowerBound('1.10.x'), '1.10.0');
t.is(getLowerBound('1.0.0'), '1.0.0');
t.is(getLowerBound('10.0.0'), '10.0.0');
t.is(getLowerBound('foo'), undefined);
});