renovate/lib/modules/manager/gradle-wrapper/util.spec.ts
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00

36 lines
1.2 KiB
TypeScript

import { GlobalConfig } from '../../../config/global';
import { extractGradleVersion, getJavaContraint } from './utils';
describe('modules/manager/gradle-wrapper/util', () => {
describe('getJavaContraint()', () => {
it('return null for global mode', () => {
expect(getJavaContraint(undefined)).toBeNull();
});
it('return ^11.0.0 for docker mode and undefined gradle', () => {
GlobalConfig.set({ binarySource: 'docker' });
expect(getJavaContraint(undefined)).toBe('^11.0.0');
});
it('return ^8.0.0 for docker gradle < 5', () => {
GlobalConfig.set({ binarySource: 'docker' });
expect(getJavaContraint('4.9')).toBe('^8.0.0');
});
it('return ^11.0.0 for docker gradle >=5 && <7', () => {
GlobalConfig.set({ binarySource: 'docker' });
expect(getJavaContraint('6.0')).toBe('^11.0.0');
});
it('return ^16.0.0 for docker gradle >= 7', () => {
GlobalConfig.set({ binarySource: 'docker' });
expect(getJavaContraint('7.0.1')).toBe('^16.0.0');
});
});
describe('extractGradleVersion()', () => {
it('works for undefined', () => {
expect(extractGradleVersion(undefined)).toBeNull();
});
});
});