From 370b119837f8d2364ee56b5ed329e206049167bb Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 25 May 2019 17:54:31 +0200
Subject: [PATCH] test: replace npm retry test

---
 .../npm/__snapshots__/index.spec.js.snap      |  2 --
 test/datasource/npm/index.spec.js             | 20 +++++++------------
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/test/datasource/npm/__snapshots__/index.spec.js.snap b/test/datasource/npm/__snapshots__/index.spec.js.snap
index 3296e2e84a..edea467237 100644
--- a/test/datasource/npm/__snapshots__/index.spec.js.snap
+++ b/test/datasource/npm/__snapshots__/index.spec.js.snap
@@ -159,8 +159,6 @@ Object {
 }
 `;
 
-exports[`api/npm should retry when 408 or 5xx 1`] = `null`;
-
 exports[`api/npm should return deprecated 1`] = `
 Object {
   "deprecationMessage": "On registry \`https://registry.npmjs.org/\`, the \\"latest\\" version (v0.0.2) of dependency \`foobar\` has the following deprecation notice:
diff --git a/test/datasource/npm/index.spec.js b/test/datasource/npm/index.spec.js
index 014e9ea18d..2e0daee0d9 100644
--- a/test/datasource/npm/index.spec.js
+++ b/test/datasource/npm/index.spec.js
@@ -232,6 +232,13 @@ describe('api/npm', () => {
     const res = await npm.getPkgReleases({ lookupName: 'foobar' });
     expect(res).toMatchSnapshot();
   });
+  it('should reject name mismatch', async () => {
+    nock('https://registry.npmjs.org')
+      .get('/different')
+      .reply(200, npmResponse);
+    const res = await npm.getPkgReleases({ lookupName: 'different' });
+    expect(res).toBeNull();
+  });
   it('should handle no time', async () => {
     delete npmResponse.time['0.0.2'];
     nock('https://registry.npmjs.org')
@@ -302,19 +309,6 @@ describe('api/npm', () => {
       Error('registry-failure')
     );
   });
-  it('should retry when 408 or 5xx', async () => {
-    nock('https://registry.npmjs.org')
-      .get('/foobar')
-      .reply(503);
-    nock('https://registry.npmjs.org')
-      .get('/foobar')
-      .reply(408);
-    nock('https://registry.npmjs.org')
-      .get('/foobar')
-      .reply(200);
-    const res = await npm.getPkgReleases({ lookupName: 'foobar' });
-    expect(res).toMatchSnapshot();
-  });
   it('should throw error for others', async () => {
     nock('https://registry.npmjs.org')
       .get('/foobar')
-- 
GitLab