2022-03-03 09:35:26 +00:00
|
|
|
import { Fixtures } from '../../../../test/fixtures';
|
2022-06-20 15:05:39 +00:00
|
|
|
import { extractPackageFile } from '.';
|
2021-10-20 13:59:33 +00:00
|
|
|
|
2022-03-03 09:35:26 +00:00
|
|
|
describe('modules/manager/bitbucket-pipelines/extract', () => {
|
2021-10-20 13:59:33 +00:00
|
|
|
describe('extractPackageFile()', () => {
|
|
|
|
it('returns null for empty', () => {
|
2023-03-29 10:41:05 +00:00
|
|
|
expect(
|
|
|
|
extractPackageFile('nothing here', 'bitbucket-pipelines.yaml')
|
|
|
|
).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns null for malformed', () => {
|
|
|
|
expect(
|
|
|
|
extractPackageFile(
|
|
|
|
'image:\n username: ccc',
|
|
|
|
'bitbucket-pipelines.yaml'
|
|
|
|
)
|
|
|
|
).toBeNull();
|
2021-10-20 13:59:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('extracts dependencies', () => {
|
2023-03-29 10:41:05 +00:00
|
|
|
const res = extractPackageFile(
|
|
|
|
Fixtures.get('bitbucket-pipelines.yaml'),
|
|
|
|
'bitbucket-pipelines.yaml'
|
|
|
|
);
|
|
|
|
expect(res).toMatchObject({
|
|
|
|
deps: [
|
|
|
|
{
|
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '10.15.1',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'node',
|
|
|
|
depType: 'docker',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '18.15.0',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'node',
|
|
|
|
depType: 'docker',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '18.15.1',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'node',
|
|
|
|
depType: 'docker',
|
|
|
|
},
|
2022-08-16 12:22:29 +00:00
|
|
|
{
|
2023-03-29 10:41:05 +00:00
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '18.15.2',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'node',
|
|
|
|
depType: 'docker',
|
2022-08-16 12:22:29 +00:00
|
|
|
},
|
|
|
|
{
|
2023-03-29 10:41:05 +00:00
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '10.15.2',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'node',
|
|
|
|
depType: 'docker',
|
2022-08-16 12:22:29 +00:00
|
|
|
},
|
2023-03-16 12:36:59 +00:00
|
|
|
{
|
2023-03-29 10:41:05 +00:00
|
|
|
currentDigest: undefined,
|
|
|
|
currentValue: '2.0.2',
|
|
|
|
datasource: 'docker',
|
|
|
|
depName: 'jfrogecosystem/jfrog-setup-cli',
|
|
|
|
depType: 'docker',
|
2023-03-16 12:36:59 +00:00
|
|
|
},
|
2022-08-16 12:22:29 +00:00
|
|
|
{
|
2023-03-29 10:41:05 +00:00
|
|
|
currentValue: '0.2.1',
|
|
|
|
datasource: 'bitbucket-tags',
|
|
|
|
depName: 'atlassian/aws-s3-deploy',
|
|
|
|
depType: 'bitbucket-tags',
|
2022-08-16 12:22:29 +00:00
|
|
|
},
|
2023-03-29 10:41:05 +00:00
|
|
|
],
|
|
|
|
});
|
2021-10-20 13:59:33 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|