From 8c361082842bb157d85ca39ecf4f6075730e74bb Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Fri, 13 Mar 2020 19:50:56 +0100
Subject: [PATCH] chore(internal): fix coverage (#5717)

---
 .../gitlab-tags/__snapshots__/index.spec.ts.snap | 16 ++++++++++++++++
 lib/datasource/gitlab-tags/index.spec.ts         | 10 ++++++++++
 lib/datasource/hex/__fixtures__/certifi.json     |  1 -
 .../hex/__snapshots__/index.spec.ts.snap         |  2 --
 lib/workers/branch/auto-replace.ts               |  4 ++--
 5 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap b/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap
index 73c1a863a9..2379601b48 100644
--- a/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap
+++ b/lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap
@@ -15,3 +15,19 @@ Object {
   "sourceUrl": "https://gitlab.company.com/api/v4/some/dep2",
 }
 `;
+
+exports[`datasource/gitlab-tags getPkgReleases returns tags with default registry 1`] = `
+Object {
+  "releases": Array [
+    Object {
+      "gitRef": "v1.0.0",
+      "version": "v1.0.0",
+    },
+    Object {
+      "gitRef": "v1.1.0",
+      "version": "v1.1.0",
+    },
+  ],
+  "sourceUrl": "https://gitlab.com/some/dep2",
+}
+`;
diff --git a/lib/datasource/gitlab-tags/index.spec.ts b/lib/datasource/gitlab-tags/index.spec.ts
index d53087847a..5982053edf 100644
--- a/lib/datasource/gitlab-tags/index.spec.ts
+++ b/lib/datasource/gitlab-tags/index.spec.ts
@@ -23,5 +23,15 @@ describe('datasource/gitlab-tags', () => {
       expect(res).toMatchSnapshot();
       expect(res.releases).toHaveLength(2);
     });
+
+    it('returns tags with default registry', async () => {
+      const body = [{ name: 'v1.0.0' }, { name: 'v1.1.0' }];
+      glGot.mockReturnValueOnce({ headers: {}, body });
+      const res = await gitlab.getPkgReleases({
+        lookupName: 'some/dep2',
+      });
+      expect(res).toMatchSnapshot();
+      expect(res.releases).toHaveLength(2);
+    });
   });
 });
diff --git a/lib/datasource/hex/__fixtures__/certifi.json b/lib/datasource/hex/__fixtures__/certifi.json
index d72dace37f..ae3248783e 100644
--- a/lib/datasource/hex/__fixtures__/certifi.json
+++ b/lib/datasource/hex/__fixtures__/certifi.json
@@ -131,7 +131,6 @@
     },
     {
       "has_docs": false,
-      "inserted_at": "2015-11-20T14:41:07.485022Z",
       "url": "https://hex.pm/api/packages/certifi/releases/0.3.0",
       "version": "0.3.0"
     },
diff --git a/lib/datasource/hex/__snapshots__/index.spec.ts.snap b/lib/datasource/hex/__snapshots__/index.spec.ts.snap
index 032b3ccffc..eb677ee4f3 100644
--- a/lib/datasource/hex/__snapshots__/index.spec.ts.snap
+++ b/lib/datasource/hex/__snapshots__/index.spec.ts.snap
@@ -73,7 +73,6 @@ Object {
       "version": "0.4.0",
     },
     Object {
-      "releaseTimestamp": "2015-11-20T14:41:07.485022Z",
       "version": "0.3.0",
     },
     Object {
@@ -162,7 +161,6 @@ Object {
       "version": "0.4.0",
     },
     Object {
-      "releaseTimestamp": "2015-11-20T14:41:07.485022Z",
       "version": "0.3.0",
     },
     Object {
diff --git a/lib/workers/branch/auto-replace.ts b/lib/workers/branch/auto-replace.ts
index 8724207ef6..2fca355682 100644
--- a/lib/workers/branch/auto-replace.ts
+++ b/lib/workers/branch/auto-replace.ts
@@ -87,9 +87,9 @@ export async function doAutoReplace(
     newValue,
     currentDigest,
     newDigest,
-    autoReplaceData = {},
+    autoReplaceData,
   } = upgrade;
-  const replaceString = autoReplaceData.replaceString || currentValue;
+  const replaceString = autoReplaceData?.replaceString || currentValue;
   logger.trace({ depName, replaceString }, 'autoReplace replaceString');
   let searchIndex = existingContent.indexOf(replaceString);
   if (searchIndex === -1) {
-- 
GitLab