0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/modules/versioning/git/index.spec.ts
2023-11-07 15:50:29 +00:00

41 lines
1.5 KiB
TypeScript

import git from '.';
describe('modules/versioning/git/index', () => {
it.each`
input | expected
${''} | ${false}
${'2'} | ${false}
${'29'} | ${false}
${'29c'} | ${false}
${'29c7'} | ${false}
${'29c79'} | ${false}
${'29c792'} | ${false}
${'29c7921'} | ${true}
${'29c792109259545157f4bc3f8d43f47ffcf34e20'} | ${true}
${'foobar'} | ${false}
`('isValid("$input") === $expected', ({ input, expected }) => {
expect(git.isValid(input)).toBe(expected);
});
it.each`
version | range | expected
${''} | ${''} | ${false}
${'1234567890aBcDeF'} | ${''} | ${true}
`(
'isCompatible("$version") === $expected',
({ version, range, expected }) => {
const res = git.isCompatible(version, range);
expect(!!res).toBe(expected);
},
);
it.each`
a | b | expected
${''} | ${''} | ${false}
${'abc'} | ${'bca'} | ${false}
${'123'} | ${'321'} | ${false}
`('isGreaterThan("$a", "$b") === $expected', ({ a, b, expected }) => {
expect(git.isGreaterThan(a, b)).toBe(expected);
});
});