2019-07-25 06:17:19 +00:00
|
|
|
import { getRangeStrategy } from '../../lib/manager';
|
|
|
|
import { RangeConfig } from '../../lib/manager/common';
|
2020-01-16 15:22:34 +00:00
|
|
|
import { MANAGER_CIRCLE_CI, MANAGER_NPM } from '../../lib/constants/managers';
|
2018-06-03 12:25:05 +00:00
|
|
|
|
|
|
|
describe('getRangeStrategy', () => {
|
|
|
|
it('returns same if not auto', () => {
|
2020-01-16 15:22:34 +00:00
|
|
|
const config: RangeConfig = {
|
|
|
|
manager: MANAGER_NPM,
|
|
|
|
rangeStrategy: 'widen',
|
|
|
|
};
|
2018-06-03 12:25:05 +00:00
|
|
|
expect(getRangeStrategy(config)).toEqual('widen');
|
|
|
|
});
|
|
|
|
it('returns manager strategy', () => {
|
2019-07-25 06:17:19 +00:00
|
|
|
const config: RangeConfig = {
|
2020-01-16 15:22:34 +00:00
|
|
|
manager: MANAGER_NPM,
|
2018-06-03 12:25:05 +00:00
|
|
|
rangeStrategy: 'auto',
|
|
|
|
depType: 'dependencies',
|
|
|
|
packageJsonType: 'app',
|
|
|
|
};
|
|
|
|
expect(getRangeStrategy(config)).toEqual('pin');
|
|
|
|
});
|
|
|
|
it('defaults to replace', () => {
|
2019-07-25 06:17:19 +00:00
|
|
|
const config: RangeConfig = {
|
2020-01-16 15:22:34 +00:00
|
|
|
manager: MANAGER_CIRCLE_CI,
|
2019-07-25 06:17:19 +00:00
|
|
|
rangeStrategy: 'auto',
|
|
|
|
};
|
2018-06-03 12:25:05 +00:00
|
|
|
expect(getRangeStrategy(config)).toEqual('replace');
|
|
|
|
});
|
|
|
|
it('returns rangeStrategy if not auto', () => {
|
2019-07-25 06:17:19 +00:00
|
|
|
const config: RangeConfig = {
|
2020-01-16 15:22:34 +00:00
|
|
|
manager: MANAGER_CIRCLE_CI,
|
2019-07-25 06:17:19 +00:00
|
|
|
rangeStrategy: 'future',
|
|
|
|
};
|
2018-06-03 12:25:05 +00:00
|
|
|
expect(getRangeStrategy(config)).toEqual('future');
|
|
|
|
});
|
|
|
|
});
|