From 2fc3df36c6a8c3f3add225bf0d4d8f5ca347158d Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 18 Sep 2018 13:43:49 -0700 Subject: [PATCH 1/2] Fix the linter --- package.json | 3 ++- test/address.js | 2 +- test/autoscaler.js | 2 +- test/disk.js | 2 +- test/firewall.js | 2 +- test/image.js | 2 +- test/instance-group.js | 2 +- test/network.js | 2 +- test/service.js | 2 +- test/snapshot.js | 2 +- test/subnetwork.js | 2 +- test/vm.js | 4 ++-- 12 files changed, 14 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 3b9875ca..71360c73 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "samples-test": "cd samples/ && npm link ../ && cd startup-script && npm link ../../ && cd ../ && npm test && cd ../", "system-test": "mocha system-test/*.js --timeout 600000", "test-no-cover": "mocha test/*.js", - "test": "npm run cover" + "test": "npm run cover", + "fix": "eslint --fix **/*.js && npm run prettier" }, "dependencies": { "@google-cloud/common": "^0.17.0", diff --git a/test/address.js b/test/address.js index f0c6f8b7..5aaaffa9 100644 --- a/test/address.js +++ b/test/address.js @@ -75,7 +75,7 @@ describe('Address', function() { }); it('should inherit from ServiceObject', function(done) { - var regionInstance = extend({}, REGION, { + const regionInstance = extend({}, REGION, { createAddress: { bind: function(context) { assert.strictEqual(context, regionInstance); diff --git a/test/autoscaler.js b/test/autoscaler.js index 3c7aee58..5fa3a088 100644 --- a/test/autoscaler.js +++ b/test/autoscaler.js @@ -81,7 +81,7 @@ describe('Autoscaler', function() { it('should inherit from ServiceObject', function() { let createMethod = util.noop; - var zoneInstance = extend({}, ZONE, { + const zoneInstance = extend({}, ZONE, { createAutoscaler: { bind: function(context) { assert.strictEqual(context, zoneInstance); diff --git a/test/disk.js b/test/disk.js index aa33a346..1fc7bbaa 100644 --- a/test/disk.js +++ b/test/disk.js @@ -113,7 +113,7 @@ describe('Disk', function() { }); it('should inherit from ServiceObject', function(done) { - var zoneInstance = extend({}, ZONE, { + const zoneInstance = extend({}, ZONE, { createDisk: { bind: function(context) { assert.strictEqual(context, zoneInstance); diff --git a/test/firewall.js b/test/firewall.js index 49c989ed..9803afa7 100644 --- a/test/firewall.js +++ b/test/firewall.js @@ -81,7 +81,7 @@ describe('Firewall', function() { }); it('should inherit from ServiceObject', function() { - var computeInstance = extend({}, COMPUTE, { + const computeInstance = extend({}, COMPUTE, { createFirewall: { bind: function(context) { assert.strictEqual(context, computeInstance); diff --git a/test/image.js b/test/image.js index 3e22aa75..7206f809 100644 --- a/test/image.js +++ b/test/image.js @@ -70,7 +70,7 @@ describe('Image', function() { }); it('should inherit from ServiceObject', function() { - var computeInstance = extend({}, COMPUTE, { + const computeInstance = extend({}, COMPUTE, { createImage: { bind: function(context) { assert.strictEqual(context, computeInstance); diff --git a/test/instance-group.js b/test/instance-group.js index 28957db2..900a2079 100644 --- a/test/instance-group.js +++ b/test/instance-group.js @@ -110,7 +110,7 @@ describe('InstanceGroup', function() { it('should inherit from ServiceObject', function(done) { let instanceGroup; - var zoneInstance = extend({}, ZONE, { + const zoneInstance = extend({}, ZONE, { createInstanceGroup: { bind: function(context) { assert.strictEqual(context, zoneInstance); diff --git a/test/network.js b/test/network.js index b2e98750..82292b41 100644 --- a/test/network.js +++ b/test/network.js @@ -109,7 +109,7 @@ describe('Network', function() { }); it('should inherit from ServiceObject', function(done) { - var computeInstance = extend({}, COMPUTE, { + const computeInstance = extend({}, COMPUTE, { createNetwork: { bind: function(context) { assert.strictEqual(context, computeInstance); diff --git a/test/service.js b/test/service.js index 822cea22..fdb11835 100644 --- a/test/service.js +++ b/test/service.js @@ -79,7 +79,7 @@ describe('Service', function() { it('should inherit from ServiceObject', function() { let createMethod = util.noop; - var computeInstance = extend({}, COMPUTE, { + const computeInstance = extend({}, COMPUTE, { createService: { bind: function(context) { assert.strictEqual(context, computeInstance); diff --git a/test/snapshot.js b/test/snapshot.js index 783b0c5e..8ffdffda 100644 --- a/test/snapshot.js +++ b/test/snapshot.js @@ -89,7 +89,7 @@ describe('Snapshot', function() { }); it('should allow creating for a Disk object snapshot', function(done) { - var scope = { + const scope = { constructor: { name: 'Disk', }, diff --git a/test/subnetwork.js b/test/subnetwork.js index e3826389..d9c39cb9 100644 --- a/test/subnetwork.js +++ b/test/subnetwork.js @@ -75,7 +75,7 @@ describe('Subnetwork', function() { it('should inherit from ServiceObject', function() { let createSubnetworkBound = {}; - var regionInstance = extend({}, REGION, { + const regionInstance = extend({}, REGION, { createSubnetwork: { bind: function(context) { assert.strictEqual(context, regionInstance); diff --git a/test/vm.js b/test/vm.js index a904dc78..66ba8d41 100644 --- a/test/vm.js +++ b/test/vm.js @@ -123,7 +123,7 @@ describe('VM', function() { }); it('should inherit from ServiceObject', function(done) { - var zoneInstance = extend({}, ZONE, { + const zoneInstance = extend({}, ZONE, { createVM: { bind: function(context) { assert.strictEqual(context, zoneInstance); @@ -181,7 +181,7 @@ describe('VM', function() { }); describe('options.readOnly', function() { - var CONFIG = extend({}, CONFIG, {readOnly: true}); + const CONFIG = extend({}, CONFIG, {readOnly: true}); it('should set the correct mode', function(done) { let expectedBody = extend({}, EXPECTED_BODY, {mode: 'READ_ONLY'}); From 679aafa2f9f4559494ecb7868fb6b2b4642bd5db Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 18 Sep 2018 15:42:54 -0700 Subject: [PATCH 2/2] fixy --- test/vm.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/vm.js b/test/vm.js index 66ba8d41..38b091f2 100644 --- a/test/vm.js +++ b/test/vm.js @@ -150,7 +150,6 @@ describe('VM', function() { }); describe('attachDisk', function() { - let CONFIG = {}; let EXPECTED_BODY; beforeEach(function() { @@ -162,12 +161,12 @@ describe('VM', function() { it('should throw if a Disk object is not provided', function() { assert.throws(function() { - vm.attachDisk('disk-3', CONFIG, assert.ifError); + vm.attachDisk('disk-3', {}, assert.ifError); }, /A Disk object must be provided/); assert.doesNotThrow(function() { vm.request = util.noop; - vm.attachDisk(DISK, CONFIG, assert.ifError); + vm.attachDisk(DISK, {}, assert.ifError); }); }); @@ -181,7 +180,7 @@ describe('VM', function() { }); describe('options.readOnly', function() { - const CONFIG = extend({}, CONFIG, {readOnly: true}); + const CONFIG = {readOnly: true}; it('should set the correct mode', function(done) { let expectedBody = extend({}, EXPECTED_BODY, {mode: 'READ_ONLY'}); @@ -213,7 +212,7 @@ describe('VM', function() { callback(); }; - vm.attachDisk(DISK, CONFIG, done); + vm.attachDisk(DISK, {}, done); }); });