-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
446 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
import { api } from '.'; | ||
|
||
describe('modules/versioning/conda/index', () => { | ||
it.each` | ||
input | expected | ||
${'0.750'} | ${true} | ||
${'1.2.3'} | ${true} | ||
${'1.9'} | ${true} | ||
${'17.04.0'} | ${true} | ||
${'==1.2.3'} | ${true} | ||
${'==1.2.3.0'} | ${true} | ||
${'==1.2.3rc0'} | ${true} | ||
${'~=1.2.3'} | ${true} | ||
${'1.2.*'} | ${true} | ||
${'>1.2.3'} | ${true} | ||
${'renovatebot/renovate'} | ${false} | ||
${'renovatebot/renovate#master'} | ${false} | ||
${'https://github.com/renovatebot/renovate.git'} | ${false} | ||
`('isValid("$input") === $expected', ({ input, expected }) => { | ||
const res = !!api.isValid(input); | ||
expect(res).toBe(expected); | ||
}); | ||
|
||
it.each` | ||
input | expected | ||
${'1.2.3'} | ${true} | ||
${'1.2.3rc0'} | ${false} | ||
${'not..version..1'} | ${false} | ||
`('isStable("$input") === $expected', ({ input, expected }) => { | ||
expect(api.isStable(input)).toBe(expected); | ||
}); | ||
|
||
it.each` | ||
a | b | expected | ||
${'1.0'} | ${'1.0.0'} | ${true} | ||
${'1.0.0'} | ${'1.0.foo'} | ${false} | ||
`('equals($a, $b) === $expected', ({ a, b, expected }) => { | ||
expect(api.equals(a, b)).toBe(expected); | ||
}); | ||
|
||
it.each` | ||
a | b | expected | ||
${'1.0'} | ${'>=1.0.0'} | ${true} | ||
${'3.0.0'} | ${'==3.0.0'} | ${true} | ||
${'1.6.2'} | ${'<2.2.1.0'} | ${true} | ||
${'3.8'} | ${'>=3.9'} | ${false} | ||
`('matches($a, $b) === $expected', ({ a, b, expected }) => { | ||
expect(api.matches(a, b)).toBe(expected); | ||
}); | ||
|
||
it.each` | ||
version | isSingle | ||
${'==1.2.3'} | ${true} | ||
${'==1.2.3rc0'} | ${true} | ||
${'==1.2.3'} | ${true} | ||
${'==1.2'} | ${true} | ||
${'== 1.2.3'} | ${true} | ||
${'==1.*'} | ${false} | ||
`('isSingleVersion("$version") === $isSingle', ({ version, isSingle }) => { | ||
const res = !!api.isSingleVersion(version); | ||
expect(res).toBe(isSingle); | ||
}); | ||
|
||
const versions = [ | ||
'0.9.4', | ||
'1.0.0', | ||
'1.1.5', | ||
'1.2.1', | ||
'1.2.2', | ||
'1.2.3', | ||
'1.3.4', | ||
'2.0.3', | ||
]; | ||
|
||
it.each` | ||
range | expected | ||
${'~=1.2.1'} | ${'1.2.3'} | ||
${'~=2.1'} | ${null} | ||
`( | ||
'getSatisfyingVersion($versions, "$range") === $expected', | ||
({ range, expected }) => { | ||
expect(api.getSatisfyingVersion(versions, range)).toBe(expected); | ||
}, | ||
); | ||
|
||
it.each` | ||
range | expected | ||
${'~=1.2.1'} | ${'1.2.1'} | ||
${'~=2.1'} | ${null} | ||
`( | ||
'minSatisfyingVersion($versions, "$range") === $expected', | ||
({ range, expected }) => { | ||
expect(api.minSatisfyingVersion(versions, range)).toBe(expected); | ||
}, | ||
); | ||
|
||
it.each` | ||
currentValue | rangeStrategy | currentVersion | newVersion | expected | ||
${'==1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'==1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'>=1.2.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'~=1.2.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'~=1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'==1.2.*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'==1.0.*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'<1.2.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'<1.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'<1.2'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'<1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'<2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'>0.9.8'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'>2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'>=2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'~=1.1.0, !=1.1.1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'~=1.1.0,!=1.1.1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${' '} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'invalid'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
${'==1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'} | ||
${'!=1.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${null} | ||
`( | ||
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"', | ||
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => { | ||
const res = api.getNewValue({ | ||
currentValue, | ||
rangeStrategy, | ||
currentVersion, | ||
newVersion, | ||
}); | ||
expect(res).toEqual(expected); | ||
}, | ||
); | ||
|
||
// it.each` | ||
// currentValue | rangeStrategy | currentVersion | newVersion | expected | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.3'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=1.2.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=1.2.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.2.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.2.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=1.2.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.2.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.0.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.0.3'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.2.*'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.2.*'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.2.*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.*'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.*'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'==1.0.*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2.2.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2.3'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1.2'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<2.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<2.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'<2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>0.9.8'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>0.9.8'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>0.9.8'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>2.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>2.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=2.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=2.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0, !=1.1.1'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0, !=1.1.1'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0, !=1.1.1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0,!=1.1.1'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0,!=1.1.1'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0,!=1.1.1'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${' '} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${' '} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${' '} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'invalid'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'invalid'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'invalid'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'===1.0.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'===1.0.3'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'===1.0.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'!=1.2.3'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'!=1.2.3'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'!=1.2.3'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'~=1.1.0,!=1.1.1'} | ${'unsupported'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.3'} | ||
// ${'>=19.12.2,<20.13.9'} | ${'replace'} | ${'19.12.2'} | ${'21.3.1'} | ${'21.3.1'} | ||
// ${'>=19.12.2,<19.13.9'} | ${'replace'} | ${'19.12.2'} | ${'20.3.1'} | ${'20.3.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'replace'} | ${'19.12.2'} | ${'20.3.1'} | ${'20.3.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'replace'} | ${'19.12.2'} | ${'20.3.0'} | ${'20.3.0'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'replace'} | ${'19.12.2'} | ${'19.13.1'} | ${'19.13.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'replace'} | ${'19.12.2'} | ${'19.13.0'} | ${'19.13.0'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'auto'} | ${'19.12.2'} | ${'19.13.0'} | ${'19.13.0'} | ||
// ${'>=19.12.2,<20.13.9'} | ${'widen'} | ${'19.12.2'} | ${'21.3.1'} | ${'21.3.1'} | ||
// ${'>=19.12.2,<19.13.9'} | ${'widen'} | ${'19.12.2'} | ${'20.3.1'} | ${'20.3.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'widen'} | ${'19.12.2'} | ${'20.3.1'} | ${'20.3.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'widen'} | ${'19.12.2'} | ${'20.3.0'} | ${'20.3.0'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'widen'} | ${'19.12.2'} | ${'19.13.1'} | ${'19.13.1'} | ||
// ${'>=19.12.2,<19.13.0'} | ${'widen'} | ${'19.12.2'} | ${'19.13.0'} | ${'19.13.0'} | ||
// ${'~=7.2'} | ${'replace'} | ${'7.2.0'} | ${'8.0.1'} | ${'8.0.1'} | ||
// ${'~=7.2'} | ${'replace'} | ${'7.2.0'} | ${'8'} | ${'8'} | ||
// ${'~=7.2.0'} | ${'replace'} | ${'7.2.0'} | ${'8.2'} | ${'8.2'} | ||
// ${'~=7.2'} | ${'widen'} | ${'7.2.0'} | ${'8.0.1'} | ${'8.0.1'} | ||
// ${'~=7.2'} | ${'widen'} | ${'7.2.0'} | ${'8'} | ${'8'} | ||
// ${'~=7.2.0'} | ${'widen'} | ${'7.2.0'} | ${'8.2'} | ${'8.2'} | ||
// ${'==3.2.*,>=3.2.2'} | ${'replace'} | ${'3.2.2'} | ${'4.1.1'} | ${'4.1.1'} | ||
// ${'==3.2.*,>=3.2.2'} | ${'replace'} | ${'3.2.2'} | ${'4.0.0'} | ${'4.0.0'} | ||
// ${'>=1.0.0,<1.1.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.0'} | ${'1.2.0'} | ||
// ${'<1.3.0'} | ${'bump'} | ${'1.3.0'} | ${'0.9.2'} | ${'0.9.2'} | ||
// ${'<1.3.0'} | ${'bump'} | ${'0.9.0'} | ${'0.9.2'} | ${'0.9.2'} | ||
// ${'<=1.3.0'} | ${'bump'} | ${'0.9.0'} | ${'0.9.2'} | ${'0.9.2'} | ||
// ${'<=1.3.0'} | ${'bump'} | ${'1.3.0'} | ${'0.9.2'} | ${'0.9.2'} | ||
// ${'<1.3.0'} | ${'bump'} | ${'1.3.0'} | ${'1.6.0'} | ${'1.6.0'} | ||
// ${'<1.3.0'} | ${'bump'} | ${'0.9.0'} | ${'1.6.0'} | ${'1.6.0'} | ||
// ${'<=1.3.0'} | ${'bump'} | ${'0.9.0'} | ${'1.6.0'} | ${'1.6.0'} | ||
// ${'<=1.3.0'} | ${'bump'} | ${'1.3.0'} | ${'1.6.0'} | ${'1.6.0'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'==1.2.3'} | ${'==1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'>=1.2.3'} | ${'>=1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'<=1.2.3'} | ${'<=1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'~=1.2.3'} | ${'~=1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'!=1.2.3'} | ${'!=1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'>1.2.3'} | ${'>1.2.3'} | ||
// ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'<1.2.3'} | ${'<1.2.3'} | ||
// `( | ||
// 'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"', | ||
// ({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => { | ||
// const isReplacement = true; | ||
// const res = api.getNewValue({ | ||
// currentValue, | ||
// rangeStrategy, | ||
// currentVersion, | ||
// newVersion, | ||
// isReplacement, | ||
// }); | ||
// expect(res).toEqual(expected); | ||
// }, | ||
// ); | ||
}); |
Oops, something went wrong.