diff --git a/src/v2/bigtable_client.js b/src/v2/bigtable_client.js index cc3d80e02..8f560acc4 100644 --- a/src/v2/bigtable_client.js +++ b/src/v2/bigtable_client.js @@ -71,13 +71,13 @@ class BigtableClient { // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = this.constructor.scopes; - var 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. - var clientHeader = [ + const clientHeader = [ `gl-node/${process.version}`, `grpc/${gaxGrpc.grpcVersion}`, `gax/${gax.version}`, @@ -88,7 +88,7 @@ class BigtableClient { } // Load the applicable protos. - var protos = merge( + const protos = merge( {}, gaxGrpc.loadProto( path.join(__dirname, '..', '..', 'protos'), @@ -114,7 +114,7 @@ class BigtableClient { }; // Put together the default options sent with requests. - var defaults = gaxGrpc.constructSettings( + const defaults = gaxGrpc.constructSettings( 'google.bigtable.v2.Bigtable', gapicConfig, opts.clientConfig, @@ -128,14 +128,14 @@ class BigtableClient { // Put together the "service stub" for // google.bigtable.v2.Bigtable. - var bigtableStub = gaxGrpc.createStub( + const bigtableStub = gaxGrpc.createStub( protos.google.bigtable.v2.Bigtable, opts ); // Iterate over each of the methods that the service provides // and create an API call method for each. - var bigtableStubMethods = [ + const bigtableStubMethods = [ 'readRows', 'sampleRowKeys', 'mutateRow', @@ -148,7 +148,7 @@ class BigtableClient { bigtableStub.then( stub => function() { - var args = Array.prototype.slice.call(arguments, 0); + const args = Array.prototype.slice.call(arguments, 0); return stub[methodName].apply(stub, args); } ), @@ -238,11 +238,11 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); * client.readRows({tableName: formattedTableName}).on('data', response => { * // doThingsWith(response) * }); @@ -285,11 +285,11 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); * client.sampleRowKeys({tableName: formattedTableName}).on('data', response => { * // doThingsWith(response) * }); @@ -343,21 +343,21 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); - * var rowKey = ''; - * var mutations = []; - * var request = { + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const rowKey = ''; + * const mutations = []; + * const request = { * tableName: formattedTableName, * rowKey: rowKey, * mutations: mutations, * }; * client.mutateRow(request) * .then(responses => { - * var response = responses[0]; + * const response = responses[0]; * // doThingsWith(response) * }) * .catch(err => { @@ -411,13 +411,13 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); - * var entries = []; - * var request = { + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const entries = []; + * const request = { * tableName: formattedTableName, * entries: entries, * }; @@ -491,19 +491,19 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); - * var rowKey = ''; - * var request = { + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const rowKey = ''; + * const request = { * tableName: formattedTableName, * rowKey: rowKey, * }; * client.checkAndMutateRow(request) * .then(responses => { - * var response = responses[0]; + * const response = responses[0]; * // doThingsWith(response) * }) * .catch(err => { @@ -567,21 +567,21 @@ class BigtableClient { * * const bigtable = require('@google-cloud/bigtable'); * - * var client = new bigtable.v2.BigtableClient({ + * const client = new bigtable.v2.BigtableClient({ * // optional auth parameters. * }); * - * var formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); - * var rowKey = ''; - * var rules = []; - * var request = { + * const formattedTableName = client.tablePath('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * const rowKey = ''; + * const rules = []; + * const request = { * tableName: formattedTableName, * rowKey: rowKey, * rules: rules, * }; * client.readModifyWriteRow(request) * .then(responses => { - * var response = responses[0]; + * const response = responses[0]; * // doThingsWith(response) * }) * .catch(err => { diff --git a/src/v2/doc/google/bigtable/v2/doc_bigtable.js b/src/v2/doc/google/bigtable/v2/doc_bigtable.js index 9f4e13f71..dc26a680e 100644 --- a/src/v2/doc/google/bigtable/v2/doc_bigtable.js +++ b/src/v2/doc/google/bigtable/v2/doc_bigtable.js @@ -46,7 +46,7 @@ * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ReadRowsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var ReadRowsRequest = { +const ReadRowsRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -69,7 +69,7 @@ var ReadRowsRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ReadRowsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var ReadRowsResponse = { +const ReadRowsResponse = { // This is for documentation. Actual contents will be loaded by gRPC. /** @@ -162,7 +162,7 @@ var ReadRowsResponse = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.SampleRowKeysRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var SampleRowKeysRequest = { +const SampleRowKeysRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -188,7 +188,7 @@ var SampleRowKeysRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.SampleRowKeysResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var SampleRowKeysResponse = { +const SampleRowKeysResponse = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -218,7 +218,7 @@ var SampleRowKeysResponse = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.MutateRowRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var MutateRowRequest = { +const MutateRowRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -228,7 +228,7 @@ var MutateRowRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.MutateRowResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var MutateRowResponse = { +const MutateRowResponse = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -255,7 +255,7 @@ var MutateRowResponse = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.MutateRowsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var MutateRowsRequest = { +const MutateRowsRequest = { // This is for documentation. Actual contents will be loaded by gRPC. /** @@ -291,7 +291,7 @@ var MutateRowsRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.MutateRowsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var MutateRowsResponse = { +const MutateRowsResponse = { // This is for documentation. Actual contents will be loaded by gRPC. /** @@ -362,7 +362,7 @@ var MutateRowsResponse = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.CheckAndMutateRowRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var CheckAndMutateRowRequest = { +const CheckAndMutateRowRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -377,7 +377,7 @@ var CheckAndMutateRowRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.CheckAndMutateRowResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var CheckAndMutateRowResponse = { +const CheckAndMutateRowResponse = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -408,7 +408,7 @@ var CheckAndMutateRowResponse = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ReadModifyWriteRowRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var ReadModifyWriteRowRequest = { +const ReadModifyWriteRowRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -424,6 +424,6 @@ var ReadModifyWriteRowRequest = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ReadModifyWriteRowResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/bigtable.proto} */ -var ReadModifyWriteRowResponse = { +const ReadModifyWriteRowResponse = { // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/src/v2/doc/google/bigtable/v2/doc_data.js b/src/v2/doc/google/bigtable/v2/doc_data.js index 66f5c4a35..d8244bf5d 100644 --- a/src/v2/doc/google/bigtable/v2/doc_data.js +++ b/src/v2/doc/google/bigtable/v2/doc_data.js @@ -34,7 +34,7 @@ * @memberof google.bigtable.v2 * @see [google.bigtable.v2.Row definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var Row = { +const Row = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -59,7 +59,7 @@ var Row = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.Family definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var Family = { +const Family = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -83,7 +83,7 @@ var Family = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.Column definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var Column = { +const Column = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -110,7 +110,7 @@ var Column = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.Cell definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var Cell = { +const Cell = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -133,7 +133,7 @@ var Cell = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.RowRange definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var RowRange = { +const RowRange = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -152,7 +152,7 @@ var RowRange = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.RowSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var RowSet = { +const RowSet = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -181,7 +181,7 @@ var RowSet = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ColumnRange definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var ColumnRange = { +const ColumnRange = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -198,7 +198,7 @@ var ColumnRange = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.TimestampRange definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var TimestampRange = { +const TimestampRange = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -221,7 +221,7 @@ var TimestampRange = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ValueRange definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var ValueRange = { +const ValueRange = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -438,7 +438,7 @@ var ValueRange = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.RowFilter definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var RowFilter = { +const RowFilter = { // This is for documentation. Actual contents will be loaded by gRPC. /** @@ -564,7 +564,7 @@ var RowFilter = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.Mutation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var Mutation = { +const Mutation = { // This is for documentation. Actual contents will be loaded by gRPC. /** @@ -675,6 +675,6 @@ var Mutation = { * @memberof google.bigtable.v2 * @see [google.bigtable.v2.ReadModifyWriteRule definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto} */ -var ReadModifyWriteRule = { +const ReadModifyWriteRule = { // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/src/v2/doc/google/protobuf/doc_any.js b/src/v2/doc/google/protobuf/doc_any.js index c5c5bbafa..3accb1fc0 100644 --- a/src/v2/doc/google/protobuf/doc_any.js +++ b/src/v2/doc/google/protobuf/doc_any.js @@ -131,6 +131,6 @@ * @memberof google.protobuf * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} */ -var Any = { +const Any = { // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/src/v2/doc/google/protobuf/doc_wrappers.js b/src/v2/doc/google/protobuf/doc_wrappers.js index 791b600ab..363b6391a 100644 --- a/src/v2/doc/google/protobuf/doc_wrappers.js +++ b/src/v2/doc/google/protobuf/doc_wrappers.js @@ -27,7 +27,7 @@ * @memberof google.protobuf * @see [google.protobuf.DoubleValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var DoubleValue = { +const DoubleValue = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -43,7 +43,7 @@ var DoubleValue = { * @memberof google.protobuf * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var FloatValue = { +const FloatValue = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -59,7 +59,7 @@ var FloatValue = { * @memberof google.protobuf * @see [google.protobuf.Int64Value definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var Int64Value = { +const Int64Value = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -75,7 +75,7 @@ var Int64Value = { * @memberof google.protobuf * @see [google.protobuf.UInt64Value definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var UInt64Value = { +const UInt64Value = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -91,7 +91,7 @@ var UInt64Value = { * @memberof google.protobuf * @see [google.protobuf.Int32Value definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var Int32Value = { +const Int32Value = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -107,7 +107,7 @@ var Int32Value = { * @memberof google.protobuf * @see [google.protobuf.UInt32Value definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var UInt32Value = { +const UInt32Value = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -123,7 +123,7 @@ var UInt32Value = { * @memberof google.protobuf * @see [google.protobuf.BoolValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var BoolValue = { +const BoolValue = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -139,7 +139,7 @@ var BoolValue = { * @memberof google.protobuf * @see [google.protobuf.StringValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var StringValue = { +const StringValue = { // This is for documentation. Actual contents will be loaded by gRPC. }; @@ -155,6 +155,6 @@ var StringValue = { * @memberof google.protobuf * @see [google.protobuf.BytesValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} */ -var BytesValue = { +const BytesValue = { // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/src/v2/doc/google/rpc/doc_status.js b/src/v2/doc/google/rpc/doc_status.js index 7122f1682..13cfcab10 100644 --- a/src/v2/doc/google/rpc/doc_status.js +++ b/src/v2/doc/google/rpc/doc_status.js @@ -87,6 +87,6 @@ * @memberof google.rpc * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} */ -var Status = { +const Status = { // This is for documentation. Actual contents will be loaded by gRPC. }; \ No newline at end of file diff --git a/test/gapic-v2.js b/test/gapic-v2.js index cab1dbbd7..4046c87dd 100644 --- a/test/gapic-v2.js +++ b/test/gapic-v2.js @@ -19,31 +19,31 @@ const through2 = require('through2'); const bigtableModule = require('../src'); -var FAKE_STATUS_CODE = 1; -var error = new Error(); +const FAKE_STATUS_CODE = 1; +const error = new Error(); error.code = FAKE_STATUS_CODE; describe('BigtableClient', () => { describe('readRows', () => { it('invokes readRows without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var request = { + const request = { tableName: formattedTableName, }; // Mock response - var lastScannedRowKey = '-126'; - var expectedResponse = { + const lastScannedRowKey = '-126'; + const expectedResponse = { lastScannedRowKey: lastScannedRowKey, }; @@ -53,7 +53,7 @@ describe('BigtableClient', () => { expectedResponse ); - var stream = client.readRows(request); + const stream = client.readRows(request); stream.on('data', response => { assert.deepStrictEqual(response, expectedResponse); done(); @@ -66,18 +66,18 @@ describe('BigtableClient', () => { }); it('invokes readRows with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var request = { + const request = { tableName: formattedTableName, }; @@ -88,7 +88,7 @@ describe('BigtableClient', () => { error ); - var stream = client.readRows(request); + const stream = client.readRows(request); stream.on('data', () => { assert.fail(); }); @@ -104,25 +104,25 @@ describe('BigtableClient', () => { describe('sampleRowKeys', () => { it('invokes sampleRowKeys without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var request = { + const request = { tableName: formattedTableName, }; // Mock response - var rowKey = '122'; - var offsetBytes = 889884095; - var expectedResponse = { + const rowKey = '122'; + const offsetBytes = 889884095; + const expectedResponse = { rowKey: rowKey, offsetBytes: offsetBytes, }; @@ -133,7 +133,7 @@ describe('BigtableClient', () => { expectedResponse ); - var stream = client.sampleRowKeys(request); + const stream = client.sampleRowKeys(request); stream.on('data', response => { assert.deepStrictEqual(response, expectedResponse); done(); @@ -146,18 +146,18 @@ describe('BigtableClient', () => { }); it('invokes sampleRowKeys with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var request = { + const request = { tableName: formattedTableName, }; @@ -168,7 +168,7 @@ describe('BigtableClient', () => { error ); - var stream = client.sampleRowKeys(request); + const stream = client.sampleRowKeys(request); stream.on('data', () => { assert.fail(); }); @@ -184,27 +184,27 @@ describe('BigtableClient', () => { describe('mutateRow', () => { it('invokes mutateRow without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var mutations = []; - var request = { + const rowKey = '122'; + const mutations = []; + const request = { tableName: formattedTableName, rowKey: rowKey, mutations: mutations, }; // Mock response - var expectedResponse = {}; + const expectedResponse = {}; // Mock Grpc layer client._innerApiCalls.mutateRow = mockSimpleGrpcMethod( @@ -220,20 +220,20 @@ describe('BigtableClient', () => { }); it('invokes mutateRow with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var mutations = []; - var request = { + const rowKey = '122'; + const mutations = []; + const request = { tableName: formattedTableName, rowKey: rowKey, mutations: mutations, @@ -257,25 +257,25 @@ describe('BigtableClient', () => { describe('mutateRows', () => { it('invokes mutateRows without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var entries = []; - var request = { + const entries = []; + const request = { tableName: formattedTableName, entries: entries, }; // Mock response - var expectedResponse = {}; + const expectedResponse = {}; // Mock Grpc layer client._innerApiCalls.mutateRows = mockServerStreamingGrpcMethod( @@ -283,7 +283,7 @@ describe('BigtableClient', () => { expectedResponse ); - var stream = client.mutateRows(request); + const stream = client.mutateRows(request); stream.on('data', response => { assert.deepStrictEqual(response, expectedResponse); done(); @@ -296,19 +296,19 @@ describe('BigtableClient', () => { }); it('invokes mutateRows with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var entries = []; - var request = { + const entries = []; + const request = { tableName: formattedTableName, entries: entries, }; @@ -320,7 +320,7 @@ describe('BigtableClient', () => { error ); - var stream = client.mutateRows(request); + const stream = client.mutateRows(request); stream.on('data', () => { assert.fail(); }); @@ -336,26 +336,26 @@ describe('BigtableClient', () => { describe('checkAndMutateRow', () => { it('invokes checkAndMutateRow without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var request = { + const rowKey = '122'; + const request = { tableName: formattedTableName, rowKey: rowKey, }; // Mock response - var predicateMatched = true; - var expectedResponse = { + const predicateMatched = true; + const expectedResponse = { predicateMatched: predicateMatched, }; @@ -373,19 +373,19 @@ describe('BigtableClient', () => { }); it('invokes checkAndMutateRow with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var request = { + const rowKey = '122'; + const request = { tableName: formattedTableName, rowKey: rowKey, }; @@ -408,27 +408,27 @@ describe('BigtableClient', () => { describe('readModifyWriteRow', () => { it('invokes readModifyWriteRow without error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var rules = []; - var request = { + const rowKey = '122'; + const rules = []; + const request = { tableName: formattedTableName, rowKey: rowKey, rules: rules, }; // Mock response - var expectedResponse = {}; + const expectedResponse = {}; // Mock Grpc layer client._innerApiCalls.readModifyWriteRow = mockSimpleGrpcMethod( @@ -444,20 +444,20 @@ describe('BigtableClient', () => { }); it('invokes readModifyWriteRow with error', done => { - var client = new bigtableModule.v2.BigtableClient({ + const client = new bigtableModule.v2.BigtableClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); // Mock request - var formattedTableName = client.tablePath( + const formattedTableName = client.tablePath( '[PROJECT]', '[INSTANCE]', '[TABLE]' ); - var rowKey = '122'; - var rules = []; - var request = { + const rowKey = '122'; + const rules = []; + const request = { tableName: formattedTableName, rowKey: rowKey, rules: rules, @@ -496,7 +496,7 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) { function mockServerStreamingGrpcMethod(expectedRequest, response, error) { return actualRequest => { assert.deepStrictEqual(actualRequest, expectedRequest); - var mockStream = through2.obj((chunk, enc, callback) => { + const mockStream = through2.obj((chunk, enc, callback) => { if (error) { callback(error); } else {