diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 499fda89..a3a3420d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: - digest: sha256:c3eae37a355402067b97cbeb6f5a7d2dd87aecfd064aeb2d2ea0bde40778cf68 image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + digest: sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 00000000..1b3ef1c7 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,13 @@ +generatedFiles: +- path: '.kokoro/**' + message: '`.kokoro` files are templated and should be updated in [`synthtool`](https://github.com/googleapis/synthtool)' +- path: '.github/CODEOWNERS' + message: 'CODEOWNERS should instead be modified via the `codeowner_team` property in .repo-metadata.json' +- path: '.github/workflows/**' + message: '`.github/workflows` (GitHub Actions) should be updated in [`synthtool`](https://github.com/googleapis/synthtool)' +- path: '.github/generated-files-bot.+(yml|yaml)' + message: '`.github/generated-files-bot.(yml|yaml)` should be updated in [`synthtool`](https://github.com/googleapis/synthtool)' +- path: 'README.md' + message: '`README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml' +- path: 'samples/README.md' + message: '`samples/README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3df11de4..891c9253 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,7 @@ on: push: branches: - - $default-branch + - master pull_request: name: ci jobs: diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 4db64e97..b283b8b9 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -4398,7 +4398,7 @@ export namespace google { public segment?: (google.cloud.videointelligence.v1.IVideoSegment|null); /** ObjectTrackingAnnotation trackId. */ - public trackId: (number|Long|string); + public trackId?: (number|Long|string|null); /** ObjectTrackingAnnotation entity. */ public entity?: (google.cloud.videointelligence.v1.IEntity|null); @@ -16061,7 +16061,7 @@ export namespace google { public segment?: (google.cloud.videointelligence.v1p3beta1.IVideoSegment|null); /** ObjectTrackingAnnotation trackId. */ - public trackId: (number|Long|string); + public trackId?: (number|Long|string|null); /** ObjectTrackingAnnotation entity. */ public entity?: (google.cloud.videointelligence.v1p3beta1.IEntity|null); @@ -16271,7 +16271,7 @@ export namespace google { public videoConfig?: (google.cloud.videointelligence.v1p3beta1.IStreamingVideoConfig|null); /** StreamingAnnotateVideoRequest inputContent. */ - public inputContent: (Uint8Array|string); + public inputContent?: (Uint8Array|string|null); /** StreamingAnnotateVideoRequest streamingRequest. */ public streamingRequest?: ("videoConfig"|"inputContent"); @@ -17555,19 +17555,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get: string; + public get?: (string|null); /** HttpRule put. */ - public put: string; + public put?: (string|null); /** HttpRule post. */ - public post: string; + public post?: (string|null); /** HttpRule delete. */ - public delete: string; + public delete?: (string|null); /** HttpRule patch. */ - public patch: string; + public patch?: (string|null); /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); diff --git a/protos/protos.js b/protos/protos.js index 0bf96aec..86a7e73d 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -11227,11 +11227,11 @@ /** * ObjectTrackingAnnotation trackId. - * @member {number|Long} trackId + * @member {number|Long|null|undefined} trackId * @memberof google.cloud.videointelligence.v1.ObjectTrackingAnnotation * @instance */ - ObjectTrackingAnnotation.prototype.trackId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ObjectTrackingAnnotation.prototype.trackId = null; /** * ObjectTrackingAnnotation entity. @@ -40490,11 +40490,11 @@ /** * ObjectTrackingAnnotation trackId. - * @member {number|Long} trackId + * @member {number|Long|null|undefined} trackId * @memberof google.cloud.videointelligence.v1p3beta1.ObjectTrackingAnnotation * @instance */ - ObjectTrackingAnnotation.prototype.trackId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ObjectTrackingAnnotation.prototype.trackId = null; /** * ObjectTrackingAnnotation entity. @@ -41110,11 +41110,11 @@ /** * StreamingAnnotateVideoRequest inputContent. - * @member {Uint8Array} inputContent + * @member {Uint8Array|null|undefined} inputContent * @memberof google.cloud.videointelligence.v1p3beta1.StreamingAnnotateVideoRequest * @instance */ - StreamingAnnotateVideoRequest.prototype.inputContent = $util.newBuffer([]); + StreamingAnnotateVideoRequest.prototype.inputContent = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -44122,43 +44122,43 @@ /** * HttpRule get. - * @member {string} get + * @member {string|null|undefined} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = ""; + HttpRule.prototype.get = null; /** * HttpRule put. - * @member {string} put + * @member {string|null|undefined} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = ""; + HttpRule.prototype.put = null; /** * HttpRule post. - * @member {string} post + * @member {string|null|undefined} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = ""; + HttpRule.prototype.post = null; /** * HttpRule delete. - * @member {string} delete + * @member {string|null|undefined} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = ""; + HttpRule.prototype["delete"] = null; /** * HttpRule patch. - * @member {string} patch + * @member {string|null|undefined} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = ""; + HttpRule.prototype.patch = null; /** * HttpRule custom. diff --git a/samples/analyze-streaming-annotation-to-storage.js b/samples/analyze-streaming-annotation-to-storage.js index c5b1bff7..7fec8a77 100644 --- a/samples/analyze-streaming-annotation-to-storage.js +++ b/samples/analyze-streaming-annotation-to-storage.js @@ -22,9 +22,8 @@ async function main(path = 'YOUR_LOCAL_FILE', outputUri = 'PATH_TO_OUTPUT') { // const path = 'Local file to analyze, e.g. ./my-file.mp4'; // const outputUri = 'Path to output, e.g. gs://path_to_output'; - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/analyze-streaming-automl-classification.js b/samples/analyze-streaming-automl-classification.js index 3816bd78..6881d377 100644 --- a/samples/analyze-streaming-automl-classification.js +++ b/samples/analyze-streaming-automl-classification.js @@ -27,9 +27,8 @@ async function main( // const modelId = 'autoMl model' // const projectId = 'Your GCP Project' - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/analyze-streaming-labels.js b/samples/analyze-streaming-labels.js index 2d7117ff..c5eeaf8c 100644 --- a/samples/analyze-streaming-labels.js +++ b/samples/analyze-streaming-labels.js @@ -20,9 +20,8 @@ async function main(path = 'YOUR_LOCAL_FILE') { * TODO(developer): Uncomment these variables before running the sample. */ // const path = 'Local file to analyze, e.g. ./my-file.mp4'; - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/analyze-streaming-object.js b/samples/analyze-streaming-object.js index 45c75dd9..534c1a6a 100644 --- a/samples/analyze-streaming-object.js +++ b/samples/analyze-streaming-object.js @@ -20,9 +20,8 @@ async function main(path = 'YOUR_LOCAL_FILE') { * TODO(developer): Uncomment these variables before running the sample. */ // const path = 'Local file to analyze, e.g. ./my-file.mp4'; - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/analyze-streaming-safe-search.js b/samples/analyze-streaming-safe-search.js index cd52bb1c..4ed9c49a 100644 --- a/samples/analyze-streaming-safe-search.js +++ b/samples/analyze-streaming-safe-search.js @@ -20,9 +20,8 @@ async function main(path = 'YOUR_LOCAL_FILE') { * TODO(developer): Uncomment these variables before running the sample. */ // const path = 'Local file to analyze, e.g. ./my-file.mp4'; - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/analyze-streaming-shot-change.js b/samples/analyze-streaming-shot-change.js index 6de961ab..d1a93259 100644 --- a/samples/analyze-streaming-shot-change.js +++ b/samples/analyze-streaming-shot-change.js @@ -20,9 +20,8 @@ async function main(path = 'YOUR_LOCAL_FILE') { * TODO(developer): Uncomment these variables before running the sample. */ // const path = 'Local file to analyze, e.g. ./my-file.mp4'; - const { - StreamingVideoIntelligenceServiceClient, - } = require('@google-cloud/video-intelligence').v1p3beta1; + const {StreamingVideoIntelligenceServiceClient} = + require('@google-cloud/video-intelligence').v1p3beta1; const fs = require('fs'); // Instantiates a client diff --git a/samples/system-test/analyze.test.js b/samples/system-test/analyze.test.js index 01853d77..0ebfce94 100644 --- a/samples/system-test/analyze.test.js +++ b/samples/system-test/analyze.test.js @@ -26,7 +26,8 @@ const cmd = 'node analyze.js'; const catUrl = 'gs://cloud-samples-data/video/cat.mp4'; const file = 'resources/googlework_short.mp4'; const file2 = 'resources/googlework_short.mp4'; -const possibleTexts = /Google|GOOGLE|SUR|OMAR|ROTO|Vice President|58oo9|LONDRES|PARIS|METRO|RUE|CARLO/; +const possibleTexts = + /Google|GOOGLE|SUR|OMAR|ROTO|Vice President|58oo9|LONDRES|PARIS|METRO|RUE|CARLO/; describe('analyze samples', () => { // analyze_labels_local diff --git a/samples/system-test/analyze.v1p2beta1.test.js b/samples/system-test/analyze.v1p2beta1.test.js index 89360576..df5fc9ee 100644 --- a/samples/system-test/analyze.v1p2beta1.test.js +++ b/samples/system-test/analyze.v1p2beta1.test.js @@ -26,7 +26,8 @@ const cmd = 'node analyze.v1p2beta1.js'; const url = 'gs://cloud-samples-data/video/cat.mp4'; const file1 = 'resources/googlework_short.mp4'; const file2 = 'resources/googlework_short.mp4'; -const possibleTexts = /Google|GOOGLE|SUR|OMAR|ROTO|Vice President|58oo9|LONDRES|PARIS|METRO|RUE|CARLO/; +const possibleTexts = + /Google|GOOGLE|SUR|OMAR|ROTO|Vice President|58oo9|LONDRES|PARIS|METRO|RUE|CARLO/; describe('analyze v1p2beta1 samples', () => { it('should detect text in a local file', async () => { diff --git a/src/v1/video_intelligence_service_client.ts b/src/v1/video_intelligence_service_client.ts index 9084adab..d94a6890 100644 --- a/src/v1/video_intelligence_service_client.ts +++ b/src/v1/video_intelligence_service_client.ts @@ -240,13 +240,14 @@ export class VideoIntelligenceServiceClient { const videoIntelligenceServiceStubMethods = ['annotateVideo']; for (const methodName of videoIntelligenceServiceStubMethods) { const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/src/v1beta2/video_intelligence_service_client.ts b/src/v1beta2/video_intelligence_service_client.ts index 92e9def2..1cdb4950 100644 --- a/src/v1beta2/video_intelligence_service_client.ts +++ b/src/v1beta2/video_intelligence_service_client.ts @@ -240,13 +240,14 @@ export class VideoIntelligenceServiceClient { const videoIntelligenceServiceStubMethods = ['annotateVideo']; for (const methodName of videoIntelligenceServiceStubMethods) { const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/src/v1p1beta1/video_intelligence_service_client.ts b/src/v1p1beta1/video_intelligence_service_client.ts index 582be694..44c8b848 100644 --- a/src/v1p1beta1/video_intelligence_service_client.ts +++ b/src/v1p1beta1/video_intelligence_service_client.ts @@ -240,13 +240,14 @@ export class VideoIntelligenceServiceClient { const videoIntelligenceServiceStubMethods = ['annotateVideo']; for (const methodName of videoIntelligenceServiceStubMethods) { const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/src/v1p2beta1/video_intelligence_service_client.ts b/src/v1p2beta1/video_intelligence_service_client.ts index 61226658..1fdeb85c 100644 --- a/src/v1p2beta1/video_intelligence_service_client.ts +++ b/src/v1p2beta1/video_intelligence_service_client.ts @@ -240,13 +240,14 @@ export class VideoIntelligenceServiceClient { const videoIntelligenceServiceStubMethods = ['annotateVideo']; for (const methodName of videoIntelligenceServiceStubMethods) { const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/src/v1p3beta1/streaming_video_intelligence_service_client.ts b/src/v1p3beta1/streaming_video_intelligence_service_client.ts index 8d848244..0d1077e2 100644 --- a/src/v1p3beta1/streaming_video_intelligence_service_client.ts +++ b/src/v1p3beta1/streaming_video_intelligence_service_client.ts @@ -212,13 +212,14 @@ export class StreamingVideoIntelligenceServiceClient { ]; for (const methodName of streamingVideoIntelligenceServiceStubMethods) { const callPromise = this.streamingVideoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/src/v1p3beta1/video_intelligence_service_client.ts b/src/v1p3beta1/video_intelligence_service_client.ts index 7528ee3f..da2b6550 100644 --- a/src/v1p3beta1/video_intelligence_service_client.ts +++ b/src/v1p3beta1/video_intelligence_service_client.ts @@ -240,13 +240,14 @@ export class VideoIntelligenceServiceClient { const videoIntelligenceServiceStubMethods = ['annotateVideo']; for (const methodName of videoIntelligenceServiceStubMethods) { const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } diff --git a/system-test/fixtures/sample/src/index.js b/system-test/fixtures/sample/src/index.js index b4ad7f7a..b3f8e9f1 100644 --- a/system-test/fixtures/sample/src/index.js +++ b/system-test/fixtures/sample/src/index.js @@ -20,7 +20,8 @@ const videointelligence = require('@google-cloud/video-intelligence'); function main() { - const videoIntelligenceServiceClient = new videointelligence.VideoIntelligenceServiceClient(); + const videoIntelligenceServiceClient = + new videointelligence.VideoIntelligenceServiceClient(); } main(); diff --git a/system-test/video_intelligence_service_smoke_test.ts b/system-test/video_intelligence_service_smoke_test.ts index dacede0c..b10b910c 100644 --- a/system-test/video_intelligence_service_smoke_test.ts +++ b/system-test/video_intelligence_service_smoke_test.ts @@ -19,11 +19,10 @@ const videoIntelligence = require('../src'); describe('VideoIntelligenceServiceSmokeTest', () => { it('successfully makes a call to the service', done => { - const client = new videoIntelligence.v1p1beta1.VideoIntelligenceServiceClient( - { + const client = + new videoIntelligence.v1p1beta1.VideoIntelligenceServiceClient({ // optional auth parameters. - } - ); + }); const inputUri = 'gs://cloud-samples-data/video/cat.mp4'; const featuresElement = 'LABEL_DETECTION'; @@ -64,11 +63,10 @@ describe('VideoIntelligenceServiceSmokeTest', () => { }); it('successfully makes a call to the service', done => { - const client = new videoIntelligence.v1p1beta1.VideoIntelligenceServiceClient( - { + const client = + new videoIntelligence.v1p1beta1.VideoIntelligenceServiceClient({ // optional auth parameters. - } - ); + }); const inputUri = 'gs://cloud-samples-data/video/cat.mp4'; const featuresElement = 'LABEL_DETECTION'; diff --git a/test/gapic_streaming_video_intelligence_service_v1p3beta1.ts b/test/gapic_streaming_video_intelligence_service_v1p3beta1.ts index 645e5e2c..e4ca8309 100644 --- a/test/gapic_streaming_video_intelligence_service_v1p3beta1.ts +++ b/test/gapic_streaming_video_intelligence_service_v1p3beta1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -75,49 +74,54 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient(); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - fallback: true, - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.streamingVideoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.streamingVideoIntelligenceServiceStub); }); it('has close method', () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + 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); @@ -126,12 +130,13 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -150,12 +155,13 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { describe('streamingAnnotateVideo', () => { it('invokes streamingAnnotateVideo without error', async () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.StreamingAnnotateVideoRequest() @@ -163,9 +169,8 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.StreamingAnnotateVideoResponse() ); - client.innerApiCalls.streamingAnnotateVideo = stubBidiStreamingCall( - expectedResponse - ); + client.innerApiCalls.streamingAnnotateVideo = + stubBidiStreamingCall(expectedResponse); const stream = client.streamingAnnotateVideo(); const promise = new Promise((resolve, reject) => { stream.on( @@ -190,20 +195,20 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { .calledWithExactly(undefined) ); assert.deepStrictEqual( - (((stream as unknown) as PassThrough)._transform as SinonStub).getCall( - 0 - ).args[0], + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], request ); }); it('invokes streamingAnnotateVideo with error', async () => { - const client = new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new streamingvideointelligenceserviceModule.v1p3beta1.StreamingVideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.StreamingAnnotateVideoRequest() @@ -236,9 +241,8 @@ describe('v1p3beta1.StreamingVideoIntelligenceServiceClient', () => { .calledWithExactly(undefined) ); assert.deepStrictEqual( - (((stream as unknown) as PassThrough)._transform as SinonStub).getCall( - 0 - ).args[0], + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], request ); }); diff --git a/test/gapic_video_intelligence_service_v1.ts b/test/gapic_video_intelligence_service_v1.ts index 7e6eaf3e..9b371ec3 100644 --- a/test/gapic_video_intelligence_service_v1.ts +++ b/test/gapic_video_intelligence_service_v1.ts @@ -26,10 +26,9 @@ import * as videointelligenceserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -96,49 +95,46 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.videoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.videoIntelligenceServiceStub); }); it('has close method', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ 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); @@ -147,12 +143,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -171,12 +166,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { describe('annotateVideo', () => { it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() @@ -185,9 +179,8 @@ describe('v1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCall(expectedResponse); const [operation] = await client.annotateVideo(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -199,12 +192,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() @@ -213,9 +205,8 @@ describe('v1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.annotateVideo( request, @@ -248,12 +239,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() @@ -273,12 +263,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() @@ -300,12 +289,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -324,12 +312,11 @@ describe('v1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient( - { + const client = + new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const expectedError = new Error('expected'); diff --git a/test/gapic_video_intelligence_service_v1beta2.ts b/test/gapic_video_intelligence_service_v1beta2.ts index 8de0f6e7..a824f2c4 100644 --- a/test/gapic_video_intelligence_service_v1beta2.ts +++ b/test/gapic_video_intelligence_service_v1beta2.ts @@ -26,10 +26,9 @@ import * as videointelligenceserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -97,49 +96,54 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient(); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - fallback: true, - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.videoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.videoIntelligenceServiceStub); }); it('has close method', () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + 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); @@ -148,12 +152,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -172,12 +177,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { describe('annotateVideo', () => { it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest() @@ -186,9 +192,8 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCall(expectedResponse); const [operation] = await client.annotateVideo(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -200,12 +205,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest() @@ -214,9 +220,8 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.annotateVideo( request, @@ -249,12 +254,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest() @@ -274,12 +280,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1beta2.AnnotateVideoRequest() @@ -301,12 +308,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -325,12 +333,13 @@ describe('v1beta2.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1beta2.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); diff --git a/test/gapic_video_intelligence_service_v1p1beta1.ts b/test/gapic_video_intelligence_service_v1p1beta1.ts index 4c682b88..e4a29144 100644 --- a/test/gapic_video_intelligence_service_v1p1beta1.ts +++ b/test/gapic_video_intelligence_service_v1p1beta1.ts @@ -26,10 +26,9 @@ import * as videointelligenceserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -97,49 +96,54 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient(); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - fallback: true, - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.videoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.videoIntelligenceServiceStub); }); it('has close method', () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + 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); @@ -148,12 +152,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -172,12 +177,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { describe('annotateVideo', () => { it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p1beta1.AnnotateVideoRequest() @@ -186,9 +192,8 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCall(expectedResponse); const [operation] = await client.annotateVideo(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -200,12 +205,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p1beta1.AnnotateVideoRequest() @@ -214,9 +220,8 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.annotateVideo( request, @@ -249,12 +254,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p1beta1.AnnotateVideoRequest() @@ -274,12 +280,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p1beta1.AnnotateVideoRequest() @@ -301,12 +308,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -325,12 +333,13 @@ describe('v1p1beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p1beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); diff --git a/test/gapic_video_intelligence_service_v1p2beta1.ts b/test/gapic_video_intelligence_service_v1p2beta1.ts index f36669f5..a08db765 100644 --- a/test/gapic_video_intelligence_service_v1p2beta1.ts +++ b/test/gapic_video_intelligence_service_v1p2beta1.ts @@ -26,10 +26,9 @@ import * as videointelligenceserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -97,49 +96,54 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient(); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - fallback: true, - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.videoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.videoIntelligenceServiceStub); }); it('has close method', () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + 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); @@ -148,12 +152,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -172,12 +177,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { describe('annotateVideo', () => { it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p2beta1.AnnotateVideoRequest() @@ -186,9 +192,8 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCall(expectedResponse); const [operation] = await client.annotateVideo(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -200,12 +205,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p2beta1.AnnotateVideoRequest() @@ -214,9 +220,8 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.annotateVideo( request, @@ -249,12 +254,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p2beta1.AnnotateVideoRequest() @@ -274,12 +280,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p2beta1.AnnotateVideoRequest() @@ -301,12 +308,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -325,12 +333,13 @@ describe('v1p2beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p2beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected'); diff --git a/test/gapic_video_intelligence_service_v1p3beta1.ts b/test/gapic_video_intelligence_service_v1p3beta1.ts index 28323f55..a68a1660 100644 --- a/test/gapic_video_intelligence_service_v1p3beta1.ts +++ b/test/gapic_video_intelligence_service_v1p3beta1.ts @@ -26,10 +26,9 @@ import * as videointelligenceserviceModule from '../src'; import {protobuf, LROperation, operationsProtos} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -97,49 +96,54 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient(); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - fallback: true, - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + fallback: true, + } + ); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); assert.strictEqual(client.videoIntelligenceServiceStub, undefined); await client.initialize(); assert(client.videoIntelligenceServiceStub); }); it('has close method', () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + 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); @@ -148,12 +152,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -172,12 +177,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { describe('annotateVideo', () => { it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.AnnotateVideoRequest() @@ -186,9 +192,8 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCall(expectedResponse); const [operation] = await client.annotateVideo(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -200,12 +205,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.AnnotateVideoRequest() @@ -214,9 +220,8 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.annotateVideo = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.annotateVideo( request, @@ -249,12 +254,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.AnnotateVideoRequest() @@ -274,12 +280,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const request = generateSampleMessage( new protos.google.cloud.videointelligence.v1p3beta1.AnnotateVideoRequest() @@ -301,12 +308,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedResponse = generateSampleMessage( new operationsProtos.google.longrunning.Operation() @@ -325,12 +333,13 @@ describe('v1p3beta1.VideoIntelligenceServiceClient', () => { }); it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( - { - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - } - ); + const client = + new videointelligenceserviceModule.v1p3beta1.VideoIntelligenceServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); client.initialize(); const expectedError = new Error('expected');