From eb624a531482197e8ba908f3a5854a21d32dbbb3 Mon Sep 17 00:00:00 2001 From: "marcos.toledo" Date: Tue, 19 Nov 2024 09:55:27 -0300 Subject: [PATCH] style: lint fixes --- lib/workers/repository/process/fetch.spec.ts | 19 +++++++++++++++---- lib/workers/repository/process/fetch.ts | 6 +++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/workers/repository/process/fetch.spec.ts b/lib/workers/repository/process/fetch.spec.ts index 5cada5fdd1b6ba..c550752092586b 100644 --- a/lib/workers/repository/process/fetch.spec.ts +++ b/lib/workers/repository/process/fetch.spec.ts @@ -61,7 +61,7 @@ describe('workers/repository/process/fetch', () => { config.packageRules = [ { matchPackageNames: ['foo'], - registryUrls: ['some-registry'] + registryUrls: ['some-registry'], }, ]; @@ -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, + }, ], }, ], @@ -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); }); diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 24935d3707a173..de0bd631d720f2 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -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; }