mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
test(manager/circleci): remove snapshots and empty matchObjects tests (#30565)
This commit is contained in:
parent
607d7e3e1b
commit
b667a4b8a3
2 changed files with 149 additions and 67 deletions
|
@ -1,42 +0,0 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`modules/manager/circleci/extract extractPackageFile() extracts multiple image lines 1`] = `
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
||||||
"currentDigest": undefined,
|
|
||||||
"currentValue": undefined,
|
|
||||||
"datasource": "docker",
|
|
||||||
"depName": "node",
|
|
||||||
"depType": "docker",
|
|
||||||
"replaceString": "node",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
||||||
"currentDigest": undefined,
|
|
||||||
"currentValue": "4",
|
|
||||||
"datasource": "docker",
|
|
||||||
"depName": "node",
|
|
||||||
"depType": "docker",
|
|
||||||
"replaceString": "node:4",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
||||||
"currentDigest": undefined,
|
|
||||||
"currentValue": "6",
|
|
||||||
"datasource": "docker",
|
|
||||||
"depName": "node",
|
|
||||||
"depType": "docker",
|
|
||||||
"replaceString": "node:6",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"autoReplaceStringTemplate": "{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}",
|
|
||||||
"currentDigest": undefined,
|
|
||||||
"currentValue": "8.9.0",
|
|
||||||
"datasource": "docker",
|
|
||||||
"depName": "node",
|
|
||||||
"depType": "docker",
|
|
||||||
"replaceString": "node:8.9.0",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
`;
|
|
|
@ -13,69 +13,193 @@ describe('modules/manager/circleci/extract', () => {
|
||||||
expect(extractPackageFile('nothing here')).toBeNull();
|
expect(extractPackageFile('nothing here')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('extracts multiple image lines', () => {
|
it('extracts multiple image and resolves yaml anchors', () => {
|
||||||
const res = extractPackageFile(file1);
|
const res = extractPackageFile(file1);
|
||||||
expect(res?.deps).toMatchSnapshot();
|
expect(res?.deps).toEqual([
|
||||||
expect(res?.deps).toHaveLength(4);
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'node',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentValue: '4',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'node:4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentValue: '6',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'node:6',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentValue: '8.9.0',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'node:8.9.0',
|
||||||
|
},
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('extracts orbs too', () => {
|
it('extracts orbs too', () => {
|
||||||
const res = extractPackageFile(file2);
|
const res = extractPackageFile(file2);
|
||||||
expect(res?.deps).toMatchObject([
|
expect(res?.deps).toEqual([
|
||||||
{
|
{
|
||||||
depName: 'release-workflows',
|
|
||||||
currentValue: '4.1.0',
|
currentValue: '4.1.0',
|
||||||
datasource: 'orb',
|
datasource: 'orb',
|
||||||
|
depName: 'release-workflows',
|
||||||
depType: 'orb',
|
depType: 'orb',
|
||||||
|
packageName: 'hutson/library-release-workflows',
|
||||||
|
versioning: 'npm',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
depName: 'no-version',
|
|
||||||
currentValue: undefined,
|
|
||||||
datasource: 'orb',
|
datasource: 'orb',
|
||||||
|
depName: 'no-version',
|
||||||
depType: 'orb',
|
depType: 'orb',
|
||||||
|
packageName: 'abc/def',
|
||||||
|
versioning: 'npm',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
depName: 'volatile',
|
|
||||||
currentValue: 'volatile',
|
currentValue: 'volatile',
|
||||||
datasource: 'orb',
|
datasource: 'orb',
|
||||||
|
depName: 'volatile',
|
||||||
depType: 'orb',
|
depType: 'orb',
|
||||||
|
packageName: 'zzz/zzz',
|
||||||
|
versioning: 'npm',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
currentValue: '3.7',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'python',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
currentValue: '3.7',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'python',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
currentValue: '3.7',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'python',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
currentValue: '3.7',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'python',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:eb6325b75c1c70b4992eaa1bdd29e24e5f14d5324b4714a49f3e67783473214b',
|
||||||
|
currentValue: '3-6',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'pypy',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'pypy:3-6@sha256:eb6325b75c1c70b4992eaa1bdd29e24e5f14d5324b4714a49f3e67783473214b',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentDigest:
|
||||||
|
'sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
|
currentValue: '3.7',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'python',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString:
|
||||||
|
'python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077',
|
||||||
},
|
},
|
||||||
{},
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
{},
|
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('extracts image without leading dash', () => {
|
it('extracts image without leading dash', () => {
|
||||||
const res = extractPackageFile(file3);
|
const res = extractPackageFile(file3);
|
||||||
expect(res?.deps).toMatchObject([
|
expect(res?.deps).toEqual([
|
||||||
{ currentValue: '14.8.0', depName: 'cimg/node' },
|
{
|
||||||
{ currentValue: '14.8.0', depName: 'cimg/node' },
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentValue: '14.8.0',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'cimg/node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'cimg/node:14.8.0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
autoReplaceStringTemplate:
|
||||||
|
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
|
||||||
|
currentValue: '14.8.0',
|
||||||
|
datasource: 'docker',
|
||||||
|
depName: 'cimg/node',
|
||||||
|
depType: 'docker',
|
||||||
|
replaceString: 'cimg/node:14.8.0',
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('extracts and exclude android images', () => {
|
it('extracts and exclude android images', () => {
|
||||||
expect(
|
expect(
|
||||||
extractPackageFile(
|
extractPackageFile(codeBlock`
|
||||||
'jobs:\n' +
|
jobs:
|
||||||
' build:\n' +
|
build:
|
||||||
' machine:\n' +
|
machine:
|
||||||
' image: android:202102-01',
|
image: android:202102-01
|
||||||
),
|
`),
|
||||||
).toBeNull();
|
).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('extracts orbs without jobs', () => {
|
it('extracts orbs without jobs', () => {
|
||||||
const res = extractPackageFile(file4);
|
const res = extractPackageFile(file4);
|
||||||
expect(res?.deps).toMatchObject([
|
expect(res?.deps).toEqual([
|
||||||
{
|
{
|
||||||
depName: 'nodejs',
|
|
||||||
currentValue: '5.2.0',
|
currentValue: '5.2.0',
|
||||||
datasource: 'orb',
|
datasource: 'orb',
|
||||||
|
depName: 'nodejs',
|
||||||
depType: 'orb',
|
depType: 'orb',
|
||||||
|
packageName: 'circleci/node',
|
||||||
|
versioning: 'npm',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue