diff --git a/package.json b/package.json index d7ae1d3f83b..a824fcc50a6 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "@types/mocha": "^5.2.6", "@types/mv": "^2.1.0", "@types/ncp": "^2.0.1", - "@types/nock": "^10.0.2", "@types/node": "^12.0.1", "@types/nunjucks": "^3.1.1", "@types/qs": "^6.5.3", @@ -80,7 +79,7 @@ "mocha": "^6.1.4", "mv": "^2.1.1", "ncp": "^2.0.0", - "nock": "^11.0.0", + "nock": "^11.3.2", "nunjucks": "^3.2.0", "open": "^6.3.0", "p-queue": "^6.0.0", diff --git a/test/test.query.ts b/test/test.query.ts index c66d6f895b0..d1f7ff28156 100644 --- a/test/test.query.ts +++ b/test/test.query.ts @@ -1,4 +1,4 @@ -// Copyright 2014-2016, Google, Inc. +// Copyright 2016 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -140,7 +140,8 @@ describe('Query params', () => { }); it('should be set if params passed are falsy', async () => { - nock(Utils.baseUrl) + const computeRemoteUrl = 'https://compute.googleapis.com'; + const r1 = nock(Utils.baseUrl) .post( '/compute/v1/projects//zones//instances//setDiskAutoDelete?autoDelete=false&deviceName=' ) @@ -153,7 +154,7 @@ describe('Query params', () => { deviceName: '', }); assert.strictEqual(Utils.getQs(res), 'autoDelete=false&deviceName='); - nock(Utils.baseUrl) + const r2 = nock(computeRemoteUrl) .post( '/compute/v1/projects//zones//instances//setDiskAutoDelete?autoDelete=false&deviceName=' ) @@ -167,7 +168,7 @@ describe('Query params', () => { }); assert.strictEqual(Utils.getQs(res2), 'autoDelete=false&deviceName='); - nock(Utils.baseUrl) + const r3 = nock(Utils.baseUrl) .post('/compute/v1/projects//zones//instanceGroupManagers//resize?size=0') .reply(200); const res3 = await localCompute.instanceGroupManagers.resize({ @@ -178,7 +179,7 @@ describe('Query params', () => { }); assert.strictEqual(Utils.getQs(res3), 'size=0'); - nock(Utils.baseUrl) + const r4 = nock(computeRemoteUrl) .post('/compute/v1/projects//zones//instanceGroupManagers//resize?size=0') .reply(200); const res4 = await remoteCompute.instanceGroupManagers.resize({ @@ -187,6 +188,10 @@ describe('Query params', () => { instanceGroupManager: '', size: 0, }); + r1.done(); + r2.done(); + r3.done(); + r4.done(); assert.strictEqual(Utils.getQs(res4), 'size=0'); });