mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(ruby): isValid for complex ranges
This commit is contained in:
parent
c02323ca5a
commit
ac63a5097c
2 changed files with 14 additions and 6 deletions
|
@ -32,13 +32,17 @@ const isSingleVersion = range => {
|
|||
const isStable = version =>
|
||||
parseVersion(version).prerelease ? false : isVersion(version);
|
||||
|
||||
const isValid = range => {
|
||||
const { version, operator } = parseRange(range);
|
||||
const isValid = input =>
|
||||
input
|
||||
.split(',')
|
||||
.map(piece => piece.trim())
|
||||
.every(range => {
|
||||
const { version, operator } = parseRange(range);
|
||||
|
||||
return operator
|
||||
? isVersion(version) && isValidOperator(operator)
|
||||
: isVersion(version);
|
||||
};
|
||||
return operator
|
||||
? isVersion(version) && isValidOperator(operator)
|
||||
: isVersion(version);
|
||||
});
|
||||
|
||||
const matches = (version, range) => satisfies(version, range);
|
||||
const maxSatisfyingVersion = (versions, range) =>
|
||||
|
|
|
@ -297,6 +297,10 @@ describe('semverRuby', () => {
|
|||
expect(semverRuby.isValid('~> 1.2.0-alpha.1')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('returns true when range is valid', () => {
|
||||
expect(semverRuby.isValid('>= 3.0.5, < 3.2')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('returns false when version is invalid', () => {
|
||||
expect(semverRuby.isVersion()).toBeFalsy();
|
||||
expect(semverRuby.isVersion('')).toBeFalsy();
|
||||
|
|
Loading…
Reference in a new issue