0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 21:48:32 +00:00
renovatebot_renovate/lib/modules/versioning/glasskube/index.spec.ts
Jakob Steiner 4b44b30b9f
feat(versioning): add versioning scheme for glasskube package manager (#29506)
Signed-off-by: Jakob Steiner <jakob.steiner@glasskube.eu>
2024-06-10 11:01:30 +00:00

55 lines
1.7 KiB
TypeScript

import { GlasskubeVersioningApi } from '.';
describe('modules/versioning/glasskube/index', () => {
const versioning = new GlasskubeVersioningApi();
it.each`
version | expected
${'v1.2.3'} | ${true}
${'v1.2.3+1'} | ${true}
${'v1.2.3-1'} | ${false}
${'v1.2.3-1+1'} | ${false}
`('isStable("$version") === $expected', ({ version, expected }) => {
expect(versioning.isStable(version)).toBe(expected);
});
it.each`
version | expected
${'alpha'} | ${false}
${'v1'} | ${false}
${'v1.2'} | ${false}
${'v1.2.3'} | ${true}
${'v1.2.3+1'} | ${true}
${'v1.2.3-1'} | ${true}
${'v1.2.3-1+1'} | ${true}
${'1.2.3-1+1'} | ${true}
`('isValid("$version") === $expected', ({ version, expected }) => {
expect(versioning.isValid(version)).toBe(expected);
});
it.each`
version | major | minor | patch
${'v1.2.3'} | ${1} | ${2} | ${3}
${'v1.2.3+1'} | ${1} | ${2} | ${3}
${'v1.2.3-1'} | ${1} | ${2} | ${3}
`(
'getMajor, getMinor, getPatch for "$version"',
({ version, major, minor, patch }) => {
expect(versioning.getMajor(version)).toBe(major);
expect(versioning.getMinor(version)).toBe(minor);
expect(versioning.getPatch(version)).toBe(patch);
},
);
it.each`
versionA | versionB
${'v1.2.3'} | ${'v1.2.3+1'}
${'v1.2.3+1'} | ${'v1.2.3+2'}
${'v1.2.3-1'} | ${'v1.2.3+1'}
${'v1.2.3-1+1'} | ${'v1.2.3+1'}
${'v1.2.3-1'} | ${'v1.2.3-1+1'}
`('getMajor, getMinor, getPatch for "$version"', ({ versionA, versionB }) => {
expect(versioning.isGreaterThan(versionB, versionA)).toBeTrue();
});
});