mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 09:06:25 +00:00
dca3418bbd
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
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import type { RangeConfig } from '../types';
|
|
import { getRangeStrategy } from '.';
|
|
|
|
describe('modules/manager/composer/range', () => {
|
|
it('returns same if not auto', () => {
|
|
const config: RangeConfig = { rangeStrategy: 'widen' };
|
|
expect(getRangeStrategy(config)).toBe('widen');
|
|
});
|
|
it('pins require-dev', () => {
|
|
const config: RangeConfig = {
|
|
rangeStrategy: 'auto',
|
|
depType: 'require-dev',
|
|
};
|
|
expect(getRangeStrategy(config)).toBe('pin');
|
|
});
|
|
it('pins project require', () => {
|
|
const config: RangeConfig = {
|
|
rangeStrategy: 'auto',
|
|
managerData: { composerJsonType: 'project' },
|
|
depType: 'require',
|
|
};
|
|
expect(getRangeStrategy(config)).toBe('pin');
|
|
});
|
|
it('widens complex ranges', () => {
|
|
const config: RangeConfig = {
|
|
rangeStrategy: 'auto',
|
|
depType: 'require',
|
|
currentValue: '^1.6.0 || ^2.0.0',
|
|
};
|
|
expect(getRangeStrategy(config)).toBe('widen');
|
|
});
|
|
it('widens complex bump', () => {
|
|
const config: RangeConfig = {
|
|
rangeStrategy: 'bump',
|
|
depType: 'require',
|
|
currentValue: '^1.6.0 || ^2.0.0',
|
|
};
|
|
expect(getRangeStrategy(config)).toBe('widen');
|
|
});
|
|
it('defaults to replace', () => {
|
|
const config: RangeConfig = { rangeStrategy: 'auto', depType: 'require' };
|
|
expect(getRangeStrategy(config)).toBe('replace');
|
|
});
|
|
it('defaults to widen for TYPO3 extensions', () => {
|
|
const config: RangeConfig = {
|
|
managerData: {
|
|
composerJsonType: 'typo3-cms-extension',
|
|
},
|
|
rangeStrategy: 'auto',
|
|
depType: 'require',
|
|
};
|
|
expect(getRangeStrategy(config)).toBe('widen');
|
|
});
|
|
});
|