Skip to content

Commit

Permalink
style: lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wildmarcos committed Nov 19, 2024
1 parent 95c7264 commit eb624a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
19 changes: 15 additions & 4 deletions lib/workers/repository/process/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('workers/repository/process/fetch', () => {
config.packageRules = [
{
matchPackageNames: ['foo'],
registryUrls: ['some-registry']
registryUrls: ['some-registry'],
},
];

Expand All @@ -70,8 +70,16 @@ describe('workers/repository/process/fetch', () => {
{
packageFile: 'pom.xml',
deps: [
{ depName: 'foo', skipReason: 'unknown-registry', datasource: MavenDatasource.id },
{ depName: 'baz', skipReason: 'unknown-registry', datasource: MavenDatasource.id },
{
depName: 'foo',
skipReason: 'unknown-registry',
datasource: MavenDatasource.id,
},
{
depName: 'baz',
skipReason: 'unknown-registry',
datasource: MavenDatasource.id,
},
],
},
],
Expand All @@ -80,8 +88,11 @@ describe('workers/repository/process/fetch', () => {
lookupUpdates.mockResolvedValue({ updates: ['a', 'b'] } as never);
await fetchUpdates(config, packageFiles);

expect(packageFiles.maven[0].deps[0].skipReason).toBe(undefined);
// removes skipReason and finds correct updates if there is a matching package rule
expect(packageFiles.maven[0].deps[0].skipReason).toBeUndefined();
expect(packageFiles.maven[0].deps[0].updates).toHaveLength(2);

// does not remove skipReason and does not find updates if there is no matching package rule
expect(packageFiles.maven[0].deps[1].skipReason).toBe('unknown-registry');
expect(packageFiles.maven[0].deps[1].updates).toHaveLength(0);
});
Expand Down
6 changes: 5 additions & 1 deletion lib/workers/repository/process/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ async function fetchDepUpdates(
depConfig = await applyPackageRules(depConfig, 'pre-lookup');
depConfig.packageName ??= depConfig.depName;

if (dep.skipReason === 'unknown-registry' && depConfig.registryUrls && depConfig.registryUrls.length > 0) {
if (
dep.skipReason === 'unknown-registry' &&
depConfig.registryUrls &&
depConfig.registryUrls.length > 0
) {
dep.skipReason = undefined;
}

Expand Down

0 comments on commit eb624a5

Please sign in to comment.