2021-03-02 20:44:55 +00:00
|
|
|
import type { RangeConfig } from './types';
|
2020-05-01 16:03:48 +00:00
|
|
|
import { getRangeStrategy } from '.';
|
2018-06-03 12:25:05 +00:00
|
|
|
|
2022-03-03 09:35:26 +00:00
|
|
|
describe('modules/manager/range', () => {
|
2018-06-03 12:25:05 +00:00
|
|
|
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',
|
|
|
|
};
|
2021-11-08 12:16:58 +00:00
|
|
|
expect(getRangeStrategy(config)).toBe('widen');
|
2018-06-03 12:25:05 +00:00
|
|
|
});
|
2022-04-12 14:49:49 +00:00
|
|
|
|
2018-06-03 12:25:05 +00:00
|
|
|
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',
|
|
|
|
};
|
2022-10-15 17:00:40 +00:00
|
|
|
expect(getRangeStrategy(config)).toBe('replace');
|
2018-06-03 12:25:05 +00:00
|
|
|
});
|
2022-04-12 14:49:49 +00:00
|
|
|
|
2018-06-03 12:25:05 +00:00
|
|
|
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',
|
|
|
|
};
|
2021-11-08 12:16:58 +00:00
|
|
|
expect(getRangeStrategy(config)).toBe('replace');
|
2018-06-03 12:25:05 +00:00
|
|
|
});
|
2022-04-12 14:49:49 +00:00
|
|
|
|
2018-06-03 12:25:05 +00:00
|
|
|
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',
|
|
|
|
};
|
2021-11-08 12:16:58 +00:00
|
|
|
expect(getRangeStrategy(config)).toBe('future');
|
2018-06-03 12:25:05 +00:00
|
|
|
});
|
|
|
|
});
|