diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.bind_device_to_gateway.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.bind_device_to_gateway.js index e5d0348f48d..8c901cc01a9 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.bind_device_to_gateway.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.bind_device_to_gateway.js @@ -23,6 +23,9 @@ function main(parent, gatewayId, deviceId) { // [START cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device.js index d38142b0f46..ee99565e08a 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device.js @@ -23,6 +23,9 @@ function main(parent, device) { // [START cloudiot_v1_generated_DeviceManager_CreateDevice_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device_registry.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device_registry.js index 6248800bb40..7ea4129928b 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device_registry.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.create_device_registry.js @@ -23,6 +23,9 @@ function main(parent, deviceRegistry) { // [START cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device.js index ab1999e2b67..e981a8a7a01 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_DeleteDevice_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device_registry.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device_registry.js index 663be451d24..37f5d2ad2ea 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device_registry.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device_registry.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device.js index db5022fb8fe..97bdebc68ab 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_GetDevice_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device_registry.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device_registry.js index 7cbb7241bc3..2ec184f4858 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device_registry.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_device_registry.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_iam_policy.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_iam_policy.js index 039b3941163..05f5ad9f0ec 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.get_iam_policy.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.get_iam_policy.js @@ -23,6 +23,9 @@ function main(resource) { // [START cloudiot_v1_generated_DeviceManager_GetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_config_versions.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_config_versions.js index be6a024d4c9..2b4d1e0189e 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_config_versions.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_config_versions.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_registries.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_registries.js index d7853e34aa2..344f409e391 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_registries.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_registries.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_states.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_states.js index d9c8519d01d..a6323204556 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_states.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_device_states.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudiot_v1_generated_DeviceManager_ListDeviceStates_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_devices.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_devices.js index 7e33937aaa9..f8751e6cea2 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.list_devices.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.list_devices.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudiot_v1_generated_DeviceManager_ListDevices_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.modify_cloud_to_device_config.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.modify_cloud_to_device_config.js index 9e415682954..8a6968b0f4e 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.modify_cloud_to_device_config.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.modify_cloud_to_device_config.js @@ -23,6 +23,9 @@ function main(name, binaryData) { // [START cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.send_command_to_device.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.send_command_to_device.js index df3997168a9..ba46cd8da18 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.send_command_to_device.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.send_command_to_device.js @@ -23,6 +23,9 @@ function main(name, binaryData) { // [START cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.set_iam_policy.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.set_iam_policy.js index 05ba74e3704..87f44955f5e 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.set_iam_policy.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.set_iam_policy.js @@ -23,6 +23,9 @@ function main(resource, policy) { // [START cloudiot_v1_generated_DeviceManager_SetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.test_iam_permissions.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.test_iam_permissions.js index 81f299d385f..d13cb26b7d4 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.test_iam_permissions.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.test_iam_permissions.js @@ -23,6 +23,9 @@ function main(resource, permissions) { // [START cloudiot_v1_generated_DeviceManager_TestIamPermissions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.unbind_device_from_gateway.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.unbind_device_from_gateway.js index 37fb81b5d88..5341f2f0681 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.unbind_device_from_gateway.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.unbind_device_from_gateway.js @@ -23,6 +23,9 @@ function main(parent, gatewayId, deviceId) { // [START cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device.js index f2c217889f9..62a144d11c9 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device.js @@ -23,6 +23,9 @@ function main(device, updateMask) { // [START cloudiot_v1_generated_DeviceManager_UpdateDevice_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device_registry.js b/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device_registry.js index c3a34b16258..06843ef1dd2 100644 --- a/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device_registry.js +++ b/packages/google-cloud-iot/samples/generated/v1/device_manager.update_device_registry.js @@ -23,6 +23,9 @@ function main(deviceRegistry, updateMask) { // [START cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-iot/samples/generated/v1/snippet_metadata.google.cloud.iot.v1.json b/packages/google-cloud-iot/samples/generated/v1/snippet_metadata.google.cloud.iot.v1.json index 13c5a252b48..f3a41c0f895 100644 --- a/packages/google-cloud-iot/samples/generated/v1/snippet_metadata.google.cloud.iot.v1.json +++ b/packages/google-cloud-iot/samples/generated/v1/snippet_metadata.google.cloud.iot.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -66,7 +66,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -106,7 +106,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -150,7 +150,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -190,7 +190,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -238,7 +238,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], @@ -282,7 +282,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -326,7 +326,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 64, "type": "FULL" } ], @@ -370,7 +370,7 @@ "segments": [ { "start": 25, - "end": 52, + "end": 55, "type": "FULL" } ], @@ -410,7 +410,7 @@ "segments": [ { "start": 25, - "end": 87, + "end": 90, "type": "FULL" } ], @@ -474,7 +474,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -522,7 +522,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -566,7 +566,7 @@ "segments": [ { "start": 25, - "end": 58, + "end": 61, "type": "FULL" } ], @@ -610,7 +610,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -658,7 +658,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -702,7 +702,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], @@ -746,7 +746,7 @@ "segments": [ { "start": 25, - "end": 65, + "end": 68, "type": "FULL" } ], @@ -794,7 +794,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -842,7 +842,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], diff --git a/packages/google-cloud-iot/src/v1/device_manager_client.ts b/packages/google-cloud-iot/src/v1/device_manager_client.ts index 948db8bca6e..3b85af18e64 100644 --- a/packages/google-cloud-iot/src/v1/device_manager_client.ts +++ b/packages/google-cloud-iot/src/v1/device_manager_client.ts @@ -28,7 +28,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -279,7 +278,8 @@ export class DeviceManagerClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -2101,7 +2101,7 @@ export class DeviceManagerClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDeviceRegistries.createStream( - this.innerApiCalls.listDeviceRegistries as gax.GaxCall, + this.innerApiCalls.listDeviceRegistries as GaxCall, request, callSettings ); @@ -2155,7 +2155,7 @@ export class DeviceManagerClient { this.initialize(); return this.descriptors.page.listDeviceRegistries.asyncIterate( this.innerApiCalls['listDeviceRegistries'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -2326,7 +2326,7 @@ export class DeviceManagerClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDevices.createStream( - this.innerApiCalls.listDevices as gax.GaxCall, + this.innerApiCalls.listDevices as GaxCall, request, callSettings ); @@ -2393,7 +2393,7 @@ export class DeviceManagerClient { this.initialize(); return this.descriptors.page.listDevices.asyncIterate( this.innerApiCalls['listDevices'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-iot/test/gapic_device_manager_v1.ts b/packages/google-cloud-iot/test/gapic_device_manager_v1.ts index d2d77742070..de9ed0370c2 100644 --- a/packages/google-cloud-iot/test/gapic_device_manager_v1.ts +++ b/packages/google-cloud-iot/test/gapic_device_manager_v1.ts @@ -113,99 +113,103 @@ function stubAsyncIterationCall( } describe('v1.DeviceManagerClient', () => { - it('has servicePath', () => { - const servicePath = devicemanagerModule.v1.DeviceManagerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = devicemanagerModule.v1.DeviceManagerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = devicemanagerModule.v1.DeviceManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + devicemanagerModule.v1.DeviceManagerClient.servicePath; + assert(servicePath); + }); - it('should create a client with no option', () => { - const client = new devicemanagerModule.v1.DeviceManagerClient(); - assert(client); - }); + it('has apiEndpoint', () => { + const apiEndpoint = + devicemanagerModule.v1.DeviceManagerClient.apiEndpoint; + assert(apiEndpoint); + }); - it('should create a client with gRPC fallback', () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - fallback: true, + it('has port', () => { + const port = devicemanagerModule.v1.DeviceManagerClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new devicemanagerModule.v1.DeviceManagerClient(); + assert(client); }); - assert.strictEqual(client.deviceManagerStub, undefined); - await client.initialize(); - assert(client.deviceManagerStub); - }); - it('has close method for the initialized client', done => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with gRPC fallback', () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + fallback: true, + }); + assert(client); }); - client.initialize(); - assert(client.deviceManagerStub); - client.close().then(() => { - done(); + + it('has initialize method and supports deferred initialization', async () => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.deviceManagerStub, undefined); + await client.initialize(); + assert(client.deviceManagerStub); }); - }); - it('has close method for the non-initialized client', done => { - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the initialized client', done => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.deviceManagerStub); + client.close().then(() => { + done(); + }); }); - assert.strictEqual(client.deviceManagerStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the non-initialized client', done => { + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.deviceManagerStub, undefined); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new devicemanagerModule.v1.DeviceManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new devicemanagerModule.v1.DeviceManagerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('createDeviceRegistry', () => {