Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Fix the linter #16

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha system-test/*.js smoke-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-gax": "^0.20.0",
Expand Down
20 changes: 10 additions & 10 deletions src/v1beta1/asset_service_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class AssetServiceClient {
// Create a `gaxGrpc` object, with any grpc-specific options
// sent to the client.
opts.scopes = this.constructor.scopes;
let gaxGrpc = new gax.GrpcClient(opts);
const gaxGrpc = new gax.GrpcClient(opts);

// Save the auth object to the client, for use by other methods.
this.auth = gaxGrpc.auth;

// Determine the client header string.
let clientHeader = [
const clientHeader = [
`gl-node/${process.version}`,
`grpc/${gaxGrpc.grpcVersion}`,
`gax/${gax.version}`,
Expand All @@ -89,7 +89,7 @@ class AssetServiceClient {
}

// Load the applicable protos.
let protos = merge(
const protos = merge(
{},
gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
Expand Down Expand Up @@ -123,10 +123,10 @@ class AssetServiceClient {
grpc: gaxGrpc.grpc,
}).operationsClient(opts);

let exportAssetsResponse = protoFilesRoot.lookup(
const exportAssetsResponse = protoFilesRoot.lookup(
'google.cloud.asset.v1beta1.ExportAssetsResponse'
);
let exportAssetsMetadata = protoFilesRoot.lookup(
const exportAssetsMetadata = protoFilesRoot.lookup(
'google.cloud.asset.v1beta1.ExportAssetsRequest'
);

Expand All @@ -139,7 +139,7 @@ class AssetServiceClient {
};

// Put together the default options sent with requests.
let defaults = gaxGrpc.constructSettings(
const defaults = gaxGrpc.constructSettings(
'google.cloud.asset.v1beta1.AssetService',
gapicConfig,
opts.clientConfig,
Expand All @@ -153,20 +153,20 @@ class AssetServiceClient {

// Put together the "service stub" for
// google.cloud.asset.v1beta1.AssetService.
let assetServiceStub = gaxGrpc.createStub(
const assetServiceStub = gaxGrpc.createStub(
protos.google.cloud.asset.v1beta1.AssetService,
opts
);

// Iterate over each of the methods that the service provides
// and create an API call method for each.
let assetServiceStubMethods = ['exportAssets', 'batchGetAssetsHistory'];
for (let methodName of assetServiceStubMethods) {
const assetServiceStubMethods = ['exportAssets', 'batchGetAssetsHistory'];
for (const methodName of assetServiceStubMethods) {
this._innerApiCalls[methodName] = gax.createApiCall(
assetServiceStub.then(
stub =>
function() {
let args = Array.prototype.slice.call(arguments, 0);
const args = Array.prototype.slice.call(arguments, 0);
return stub[methodName].apply(stub, args);
}
),
Expand Down
52 changes: 26 additions & 26 deletions test/gapic-v1beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ const assert = require('assert');

const assetModule = require('../src');

let FAKE_STATUS_CODE = 1;
let error = new Error();
const FAKE_STATUS_CODE = 1;
const error = new Error();
error.code = FAKE_STATUS_CODE;

describe('AssetServiceClient', () => {
describe('exportAssets', function() {
it('invokes exportAssets without error', done => {
let client = new assetModule.v1beta1.AssetServiceClient({
const client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
let formattedParent = client.projectPath('[PROJECT]');
let outputConfig = {};
let request = {
const formattedParent = client.projectPath('[PROJECT]');
const outputConfig = {};
const request = {
parent: formattedParent,
outputConfig: outputConfig,
};

// Mock response
let expectedResponse = {};
const expectedResponse = {};

// Mock Grpc layer
client._innerApiCalls.exportAssets = mockLongRunningGrpcMethod(
Expand All @@ -50,7 +50,7 @@ describe('AssetServiceClient', () => {
client
.exportAssets(request)
.then(responses => {
let operation = responses[0];
const operation = responses[0];
return operation.promise();
})
.then(responses => {
Expand All @@ -63,15 +63,15 @@ describe('AssetServiceClient', () => {
});

it('invokes exportAssets with error', done => {
let client = new assetModule.v1beta1.AssetServiceClient({
const client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
let formattedParent = client.projectPath('[PROJECT]');
let outputConfig = {};
let request = {
const formattedParent = client.projectPath('[PROJECT]');
const outputConfig = {};
const request = {
parent: formattedParent,
outputConfig: outputConfig,
};
Expand All @@ -86,7 +86,7 @@ describe('AssetServiceClient', () => {
client
.exportAssets(request)
.then(responses => {
let operation = responses[0];
const operation = responses[0];
return operation.promise();
})
.then(() => {
Expand All @@ -100,7 +100,7 @@ describe('AssetServiceClient', () => {
});

it('has longrunning decoder functions', () => {
let client = new assetModule.v1beta1.AssetServiceClient({
const client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});
Expand All @@ -117,23 +117,23 @@ describe('AssetServiceClient', () => {

describe('batchGetAssetsHistory', () => {
it('invokes batchGetAssetsHistory without error', done => {
let client = new assetModule.v1beta1.AssetServiceClient({
const client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
let formattedParent = client.projectPath('[PROJECT]');
let contentType = 'CONTENT_TYPE_UNSPECIFIED';
let readTimeWindow = {};
let request = {
const formattedParent = client.projectPath('[PROJECT]');
const contentType = 'CONTENT_TYPE_UNSPECIFIED';
const readTimeWindow = {};
const request = {
parent: formattedParent,
contentType: contentType,
readTimeWindow: readTimeWindow,
};

// Mock response
let expectedResponse = {};
const expectedResponse = {};

// Mock Grpc layer
client._innerApiCalls.batchGetAssetsHistory = mockSimpleGrpcMethod(
Expand All @@ -149,16 +149,16 @@ describe('AssetServiceClient', () => {
});

it('invokes batchGetAssetsHistory with error', done => {
let client = new assetModule.v1beta1.AssetServiceClient({
const client = new assetModule.v1beta1.AssetServiceClient({
credentials: {client_email: 'bogus', private_key: 'bogus'},
projectId: 'bogus',
});

// Mock request
let formattedParent = client.projectPath('[PROJECT]');
let contentType = 'CONTENT_TYPE_UNSPECIFIED';
let readTimeWindow = {};
let request = {
const formattedParent = client.projectPath('[PROJECT]');
const contentType = 'CONTENT_TYPE_UNSPECIFIED';
const readTimeWindow = {};
const request = {
parent: formattedParent,
contentType: contentType,
readTimeWindow: readTimeWindow,
Expand Down Expand Up @@ -197,7 +197,7 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {
function mockLongRunningGrpcMethod(expectedRequest, response, error) {
return request => {
assert.deepStrictEqual(request, expectedRequest);
let mockOperation = {
const mockOperation = {
promise: function() {
return new Promise((resolve, reject) => {
if (error) {
Expand Down