From 3e27dcd8c721ba128dc4a25a77de5c7b017683c1 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 7 Apr 2020 16:15:09 +0200
Subject: [PATCH] fix: defaultRegistryUrls

---
 lib/datasource/nuget/index.spec.ts | 13 -------------
 lib/datasource/nuget/index.ts      |  4 ++--
 lib/manager/nuget/extract.ts       |  2 +-
 3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/lib/datasource/nuget/index.spec.ts b/lib/datasource/nuget/index.spec.ts
index 5fa8ac0e3b..986835311d 100644
--- a/lib/datasource/nuget/index.spec.ts
+++ b/lib/datasource/nuget/index.spec.ts
@@ -58,10 +58,6 @@ const nugetIndexV3 = fs.readFileSync(
   'utf8'
 );
 
-const configNoRegistryUrls = {
-  lookupName: 'nunit',
-};
-
 const configV3V2 = {
   lookupName: 'nunit',
   registryUrls: [
@@ -118,15 +114,6 @@ describe('datasource/nuget', () => {
       expect(got.mock.calls[0][0]).toEqual('https://my-registry/');
     });
 
-    it('queries the default nuget feed if no registries are supplied', async () => {
-      await nuget.getReleases({
-        ...configNoRegistryUrls,
-      });
-      expect(got.mock.calls[0][0]).toEqual(
-        'https://api.nuget.org/v3/index.json'
-      );
-    });
-
     it(`can't get packages list (v3)`, async () => {
       got.mockReturnValueOnce({
         body: JSON.parse(nugetIndexV3),
diff --git a/lib/datasource/nuget/index.ts b/lib/datasource/nuget/index.ts
index 5d039566d5..fbffe0c72f 100644
--- a/lib/datasource/nuget/index.ts
+++ b/lib/datasource/nuget/index.ts
@@ -6,7 +6,7 @@ import { GetReleasesConfig, ReleaseResult } from '../common';
 
 export { id } from './common';
 
-export { getDefaultFeed } from './v3';
+export const defaultRegistryUrls = [v3.getDefaultFeed()];
 
 function parseRegistryUrl(
   registryUrl: string
@@ -35,7 +35,7 @@ export async function getReleases({
 }: GetReleasesConfig): Promise<ReleaseResult> {
   logger.trace(`nuget.getReleases(${lookupName})`);
   let dep: ReleaseResult = null;
-  for (const feed of registryUrls || [v3.getDefaultFeed()]) {
+  for (const feed of registryUrls) {
     const { feedUrl, protocolVersion } = parseRegistryUrl(feed);
     if (protocolVersion === 2) {
       dep = await v2.getReleases(feedUrl, lookupName);
diff --git a/lib/manager/nuget/extract.ts b/lib/manager/nuget/extract.ts
index 5337f3fdd6..3149ddadec 100644
--- a/lib/manager/nuget/extract.ts
+++ b/lib/manager/nuget/extract.ts
@@ -42,7 +42,7 @@ async function determineRegistryUrls(
     return undefined;
   }
 
-  const registryUrls = [datasourceNuget.getDefaultFeed()];
+  const registryUrls = datasourceNuget.defaultRegistryUrls;
   for (const child of packageSources.children) {
     if (child.type === 'element') {
       if (child.name === 'clear') {
-- 
GitLab