2020-02-05 00:14:31 +00:00
|
|
|
import { RangeConfig } from './common';
|
2020-05-01 16:03:48 +00:00
|
|
|
import { getRangeStrategy } from '.';
|
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 = {
|
2020-02-04 09:37:24 +00:00
|
|
|
manager: 'npm',
|
2020-01-16 15:22:34 +00:00
|
|
|
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-02-04 09:37:24 +00:00
|
|
|
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-02-04 09:37:24 +00:00
|
|
|
manager: 'circleci',
|
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-02-04 09:37:24 +00:00
|
|
|
manager: 'circleci',
|
2019-07-25 06:17:19 +00:00
|
|
|
rangeStrategy: 'future',
|
|
|
|
};
|
2018-06-03 12:25:05 +00:00
|
|
|
expect(getRangeStrategy(config)).toEqual('future');
|
|
|
|
});
|
|
|
|
});
|