2023-06-16 17:57:34 +00:00
|
|
|
import { extractPackageFile } from '.';
|
2020-03-18 08:55:43 +00:00
|
|
|
|
2022-03-03 09:35:26 +00:00
|
|
|
describe('modules/manager/nodenv/extract', () => {
|
2020-03-18 08:55:43 +00:00
|
|
|
describe('extractPackageFile()', () => {
|
|
|
|
it('returns a result', () => {
|
|
|
|
const res = extractPackageFile('8.4.0\n');
|
2021-08-24 09:22:51 +00:00
|
|
|
expect(res.deps).toEqual([
|
|
|
|
{
|
|
|
|
currentValue: '8.4.0',
|
|
|
|
datasource: 'github-tags',
|
|
|
|
depName: 'node',
|
2022-03-03 15:08:43 +00:00
|
|
|
packageName: 'nodejs/node',
|
2021-08-24 09:22:51 +00:00
|
|
|
},
|
|
|
|
]);
|
2020-03-18 08:55:43 +00:00
|
|
|
});
|
2022-04-12 14:49:49 +00:00
|
|
|
|
2020-03-18 08:55:43 +00:00
|
|
|
it('supports ranges', () => {
|
|
|
|
const res = extractPackageFile('8.4\n');
|
2021-08-24 09:22:51 +00:00
|
|
|
expect(res.deps).toEqual([
|
|
|
|
{
|
|
|
|
currentValue: '8.4',
|
|
|
|
datasource: 'github-tags',
|
|
|
|
depName: 'node',
|
2022-03-03 15:08:43 +00:00
|
|
|
packageName: 'nodejs/node',
|
2021-08-24 09:22:51 +00:00
|
|
|
},
|
|
|
|
]);
|
2020-03-18 08:55:43 +00:00
|
|
|
});
|
2022-04-12 14:49:49 +00:00
|
|
|
|
2020-03-18 08:55:43 +00:00
|
|
|
it('skips non ranges', () => {
|
|
|
|
const res = extractPackageFile('latestn');
|
2021-08-24 09:22:51 +00:00
|
|
|
expect(res.deps).toEqual([
|
|
|
|
{
|
|
|
|
currentValue: 'latestn',
|
|
|
|
datasource: 'github-tags',
|
|
|
|
depName: 'node',
|
2022-03-03 15:08:43 +00:00
|
|
|
packageName: 'nodejs/node',
|
2021-08-24 09:22:51 +00:00
|
|
|
},
|
|
|
|
]);
|
2020-03-18 08:55:43 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|