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', () => {
|
|
|
|
expect(extractPackageFile('nothing here')).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('extracts dependencies', () => {
|
2022-01-23 21:23:54 +00:00
|
|
|
const res = extractPackageFile(Fixtures.get('bitbucket-pipelines.yaml'));
|
2022-06-20 15:05:39 +00:00
|
|
|
expect(res?.deps).toMatchInlineSnapshot(`
|
2021-10-20 13:59:33 +00:00
|
|
|
Array [
|
|
|
|
Object {
|
|
|
|
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
|
|
"currentDigest": undefined,
|
|
|
|
"currentValue": "10.15.1",
|
|
|
|
"datasource": "docker",
|
|
|
|
"depName": "node",
|
|
|
|
"depType": "docker",
|
|
|
|
"replaceString": "node:10.15.1",
|
|
|
|
},
|
|
|
|
Object {
|
|
|
|
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
|
|
"currentDigest": undefined,
|
|
|
|
"currentValue": "10.15.2",
|
|
|
|
"datasource": "docker",
|
|
|
|
"depName": "node",
|
|
|
|
"depType": "docker",
|
|
|
|
"replaceString": "node:10.15.2",
|
|
|
|
},
|
|
|
|
Object {
|
|
|
|
"currentValue": "0.2.1",
|
|
|
|
"datasource": "bitbucket-tags",
|
|
|
|
"depName": "atlassian/aws-s3-deploy",
|
|
|
|
"depType": "bitbucket-tags",
|
|
|
|
},
|
|
|
|
]
|
|
|
|
`);
|
2022-06-20 15:05:39 +00:00
|
|
|
expect(res?.deps).toHaveLength(3);
|
2021-10-20 13:59:33 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|