From 5042146e9337f16e10abb6f2132dd4db71309944 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 17:00:07 +0000 Subject: [PATCH] chore: new owl bot post processor docker image (#41) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- packages/google-appengine/protos/protos.d.ts | 12 +- packages/google-appengine/protos/protos.js | 24 +- .../src/v1/applications_client.ts | 42 ++- .../src/v1/authorized_certificates_client.ts | 80 ++--- .../src/v1/authorized_domains_client.ts | 44 ++- .../src/v1/domain_mappings_client.ts | 80 ++--- .../src/v1/firewall_client.ts | 89 +++-- .../src/v1/instances_client.ts | 71 ++-- .../src/v1/services_client.ts | 71 ++-- .../src/v1/versions_client.ts | 80 ++--- .../system-test/fixtures/sample/src/index.js | 3 +- .../test/gapic_applications_v1.ts | 42 +-- .../test/gapic_authorized_certificates_v1.ts | 322 ++++++++---------- .../test/gapic_authorized_domains_v1.ts | 95 +++--- .../test/gapic_domain_mappings_v1.ts | 112 +++--- .../test/gapic_firewall_v1.ts | 102 +++--- .../test/gapic_instances_v1.ts | 97 +++--- .../test/gapic_services_v1.ts | 91 +++-- .../test/gapic_versions_v1.ts | 101 +++--- 19 files changed, 702 insertions(+), 856 deletions(-) diff --git a/packages/google-appengine/protos/protos.d.ts b/packages/google-appengine/protos/protos.d.ts index cd45a6e427e..9ac0d6d90e7 100644 --- a/packages/google-appengine/protos/protos.d.ts +++ b/packages/google-appengine/protos/protos.d.ts @@ -13192,7 +13192,7 @@ export namespace google { constructor(properties?: google.appengine.v1.IEntrypoint); /** Entrypoint shell. */ - public shell: string; + public shell?: (string|null); /** Entrypoint command. */ public command?: "shell"; @@ -14850,19 +14850,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/packages/google-appengine/protos/protos.js b/packages/google-appengine/protos/protos.js index 5170b8318d6..d1b8dc50776 100644 --- a/packages/google-appengine/protos/protos.js +++ b/packages/google-appengine/protos/protos.js @@ -32767,11 +32767,11 @@ /** * Entrypoint shell. - * @member {string} shell + * @member {string|null|undefined} shell * @memberof google.appengine.v1.Entrypoint * @instance */ - Entrypoint.prototype.shell = ""; + Entrypoint.prototype.shell = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -36656,43 +36656,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/packages/google-appengine/src/v1/applications_client.ts b/packages/google-appengine/src/v1/applications_client.ts index a210a365b51..f5e76c1eefb 100644 --- a/packages/google-appengine/src/v1/applications_client.ts +++ b/packages/google-appengine/src/v1/applications_client.ts @@ -275,13 +275,14 @@ export class ApplicationsClient { ]; for (const methodName of applicationsStubMethods) { const callPromise = this.applicationsStub.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; } @@ -433,11 +434,10 @@ export class ApplicationsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getApplication(request, options, callback); } @@ -688,11 +688,10 @@ export class ApplicationsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateApplication(request, options, callback); } @@ -839,11 +838,10 @@ export class ApplicationsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.repairApplication(request, options, callback); } diff --git a/packages/google-appengine/src/v1/authorized_certificates_client.ts b/packages/google-appengine/src/v1/authorized_certificates_client.ts index f52010ee5b8..69dd54f0897 100644 --- a/packages/google-appengine/src/v1/authorized_certificates_client.ts +++ b/packages/google-appengine/src/v1/authorized_certificates_client.ts @@ -238,13 +238,14 @@ export class AuthorizedCertificatesClient { ]; for (const methodName of authorizedCertificatesStubMethods) { const callPromise = this.authorizedCertificatesStub.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; } @@ -407,11 +408,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getAuthorizedCertificate( request, @@ -511,11 +511,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createAuthorizedCertificate( request, @@ -624,11 +623,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateAuthorizedCertificate( request, @@ -727,11 +725,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteAuthorizedCertificate( request, @@ -833,11 +830,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listAuthorizedCertificates( request, @@ -878,11 +874,10 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listAuthorizedCertificates.createStream( @@ -930,17 +925,16 @@ export class AuthorizedCertificatesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listAuthorizedCertificates.asyncIterate( this.innerApiCalls['listAuthorizedCertificates'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/authorized_domains_client.ts b/packages/google-appengine/src/v1/authorized_domains_client.ts index ed7fd17e480..cdd18c8f71e 100644 --- a/packages/google-appengine/src/v1/authorized_domains_client.ts +++ b/packages/google-appengine/src/v1/authorized_domains_client.ts @@ -232,13 +232,14 @@ export class AuthorizedDomainsClient { const authorizedDomainsStubMethods = ['listAuthorizedDomains']; for (const methodName of authorizedDomainsStubMethods) { const callPromise = this.authorizedDomainsStub.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; } @@ -406,11 +407,10 @@ export class AuthorizedDomainsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listAuthorizedDomains(request, options, callback); } @@ -445,11 +445,10 @@ export class AuthorizedDomainsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listAuthorizedDomains.createStream( @@ -495,17 +494,16 @@ export class AuthorizedDomainsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listAuthorizedDomains.asyncIterate( this.innerApiCalls['listAuthorizedDomains'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/domain_mappings_client.ts b/packages/google-appengine/src/v1/domain_mappings_client.ts index 4de0e8eb699..4fcd7ba8ff9 100644 --- a/packages/google-appengine/src/v1/domain_mappings_client.ts +++ b/packages/google-appengine/src/v1/domain_mappings_client.ts @@ -291,13 +291,14 @@ export class DomainMappingsClient { ]; for (const methodName of domainMappingsStubMethods) { const callPromise = this.domainMappingsStub.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; } @@ -455,11 +456,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getDomainMapping(request, options, callback); } @@ -568,11 +568,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createDomainMapping(request, options, callback); } @@ -719,11 +718,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateDomainMapping(request, options, callback); } @@ -864,11 +862,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteDomainMapping(request, options, callback); } @@ -994,11 +991,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listDomainMappings(request, options, callback); } @@ -1033,11 +1029,10 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listDomainMappings.createStream( @@ -1083,17 +1078,16 @@ export class DomainMappingsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listDomainMappings.asyncIterate( this.innerApiCalls['listDomainMappings'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/firewall_client.ts b/packages/google-appengine/src/v1/firewall_client.ts index e3387f65cb0..925c5448806 100644 --- a/packages/google-appengine/src/v1/firewall_client.ts +++ b/packages/google-appengine/src/v1/firewall_client.ts @@ -246,13 +246,14 @@ export class FirewallClient { ]; for (const methodName of firewallStubMethods) { const callPromise = this.firewallStub.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; } @@ -419,11 +420,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.batchUpdateIngressRules( request, @@ -521,11 +521,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createIngressRule(request, options, callback); } @@ -606,11 +605,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getIngressRule(request, options, callback); } @@ -697,11 +695,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateIngressRule(request, options, callback); } @@ -784,11 +781,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteIngressRule(request, options, callback); } @@ -883,11 +879,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listIngressRules(request, options, callback); } @@ -927,11 +922,10 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listIngressRules.createStream( @@ -982,17 +976,16 @@ export class FirewallClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listIngressRules.asyncIterate( this.innerApiCalls['listIngressRules'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/instances_client.ts b/packages/google-appengine/src/v1/instances_client.ts index ffdaaef4a63..4a7241a9bbc 100644 --- a/packages/google-appengine/src/v1/instances_client.ts +++ b/packages/google-appengine/src/v1/instances_client.ts @@ -279,13 +279,14 @@ export class InstancesClient { ]; for (const methodName of instancesStubMethods) { const callPromise = this.instancesStub.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; } @@ -441,11 +442,10 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getInstance(request, options, callback); } @@ -559,11 +559,10 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteInstance(request, options, callback); } @@ -717,11 +716,10 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.debugInstance(request, options, callback); } @@ -849,11 +847,10 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listInstances(request, options, callback); } @@ -889,11 +886,10 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listInstances.createStream( @@ -940,17 +936,16 @@ export class InstancesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listInstances.asyncIterate( this.innerApiCalls['listInstances'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/services_client.ts b/packages/google-appengine/src/v1/services_client.ts index 520af295621..965d73f7a9d 100644 --- a/packages/google-appengine/src/v1/services_client.ts +++ b/packages/google-appengine/src/v1/services_client.ts @@ -279,13 +279,14 @@ export class ServicesClient { ]; for (const methodName of servicesStubMethods) { const callPromise = this.servicesStub.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; } @@ -440,11 +441,10 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getService(request, options, callback); } @@ -564,11 +564,10 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateService(request, options, callback); } @@ -706,11 +705,10 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteService(request, options, callback); } @@ -834,11 +832,10 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listServices(request, options, callback); } @@ -873,11 +870,10 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listServices.createStream( @@ -923,17 +919,16 @@ export class ServicesClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/src/v1/versions_client.ts b/packages/google-appengine/src/v1/versions_client.ts index 387af2a6ad2..7f19a81faee 100644 --- a/packages/google-appengine/src/v1/versions_client.ts +++ b/packages/google-appengine/src/v1/versions_client.ts @@ -291,13 +291,14 @@ export class VersionsClient { ]; for (const methodName of versionsStubMethods) { const callPromise = this.versionsStub.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; } @@ -457,11 +458,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getVersion(request, options, callback); } @@ -566,11 +566,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.createVersion(request, options, callback); } @@ -749,11 +748,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateVersion(request, options, callback); } @@ -892,11 +890,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.deleteVersion(request, options, callback); } @@ -1023,11 +1020,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listVersions(request, options, callback); } @@ -1065,11 +1061,10 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listVersions.createStream( @@ -1118,17 +1113,16 @@ export class VersionsClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listVersions.asyncIterate( this.innerApiCalls['listVersions'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-appengine/system-test/fixtures/sample/src/index.js b/packages/google-appengine/system-test/fixtures/sample/src/index.js index ddca6b767a2..ab8790783d6 100644 --- a/packages/google-appengine/system-test/fixtures/sample/src/index.js +++ b/packages/google-appengine/system-test/fixtures/sample/src/index.js @@ -21,7 +21,8 @@ const appengine = require('@google-cloud/appengine-admin'); function main() { const applicationsClient = new appengine.ApplicationsClient(); - const authorizedCertificatesClient = new appengine.AuthorizedCertificatesClient(); + const authorizedCertificatesClient = + new appengine.AuthorizedCertificatesClient(); const authorizedDomainsClient = new appengine.AuthorizedDomainsClient(); const domainMappingsClient = new appengine.DomainMappingsClient(); const firewallClient = new appengine.FirewallClient(); diff --git a/packages/google-appengine/test/gapic_applications_v1.ts b/packages/google-appengine/test/gapic_applications_v1.ts index 5cb12e0d319..ca9079c944c 100644 --- a/packages/google-appengine/test/gapic_applications_v1.ts +++ b/packages/google-appengine/test/gapic_applications_v1.ts @@ -26,10 +26,9 @@ import * as applicationsModule 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; @@ -216,9 +215,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.Application() ); - client.innerApiCalls.getApplication = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getApplication = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getApplication( request, @@ -289,9 +287,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createApplication = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createApplication = + stubLongRunningCall(expectedResponse); const [operation] = await client.createApplication(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -315,9 +312,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createApplication = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createApplication = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createApplication( request, @@ -461,9 +457,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateApplication = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateApplication = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateApplication(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -495,9 +490,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateApplication = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateApplication = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateApplication( request, @@ -657,9 +651,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.repairApplication = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.repairApplication = + stubLongRunningCall(expectedResponse); const [operation] = await client.repairApplication(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -691,9 +684,8 @@ describe('v1.ApplicationsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.repairApplication = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.repairApplication = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.repairApplication( request, diff --git a/packages/google-appengine/test/gapic_authorized_certificates_v1.ts b/packages/google-appengine/test/gapic_authorized_certificates_v1.ts index c116977313a..244d10116a6 100644 --- a/packages/google-appengine/test/gapic_authorized_certificates_v1.ts +++ b/packages/google-appengine/test/gapic_authorized_certificates_v1.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; @@ -134,49 +133,46 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('should create a client with no option', () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient(); + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient(); assert(client); }); it('should create a client with gRPC fallback', () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ fallback: true, - } - ); + }); assert(client); }); it('has initialize method and supports deferred initialization', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); assert.strictEqual(client.authorizedCertificatesStub, undefined); await client.initialize(); assert(client.authorizedCertificatesStub); }); it('has close method', () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.close(); }); it('has getProjectId method', async () => { const fakeProjectId = 'fake-project-id'; - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ 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); @@ -185,12 +181,11 @@ describe('v1.AuthorizedCertificatesClient', () => { it('has getProjectId method with callback', async () => { const fakeProjectId = 'fake-project-id'; - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.auth.getProjectId = sinon .stub() .callsArgWith(0, null, fakeProjectId); @@ -209,12 +204,11 @@ describe('v1.AuthorizedCertificatesClient', () => { describe('getAuthorizedCertificate', () => { it('invokes getAuthorizedCertificate without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.GetAuthorizedCertificateRequest() @@ -231,9 +225,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.getAuthorizedCertificate = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getAuthorizedCertificate = + stubSimpleCall(expectedResponse); const [response] = await client.getAuthorizedCertificate(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -244,12 +237,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes getAuthorizedCertificate without error using callback', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.GetAuthorizedCertificateRequest() @@ -266,9 +258,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.getAuthorizedCertificate = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getAuthorizedCertificate = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getAuthorizedCertificate( request, @@ -294,12 +285,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes getAuthorizedCertificate with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.GetAuthorizedCertificateRequest() @@ -332,12 +322,11 @@ describe('v1.AuthorizedCertificatesClient', () => { describe('createAuthorizedCertificate', () => { it('invokes createAuthorizedCertificate without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.CreateAuthorizedCertificateRequest() @@ -354,9 +343,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.createAuthorizedCertificate = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createAuthorizedCertificate = + stubSimpleCall(expectedResponse); const [response] = await client.createAuthorizedCertificate(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -367,12 +355,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes createAuthorizedCertificate without error using callback', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.CreateAuthorizedCertificateRequest() @@ -389,9 +376,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.createAuthorizedCertificate = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createAuthorizedCertificate = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createAuthorizedCertificate( request, @@ -417,12 +403,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes createAuthorizedCertificate with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.CreateAuthorizedCertificateRequest() @@ -455,12 +440,11 @@ describe('v1.AuthorizedCertificatesClient', () => { describe('updateAuthorizedCertificate', () => { it('invokes updateAuthorizedCertificate without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.UpdateAuthorizedCertificateRequest() @@ -477,9 +461,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.updateAuthorizedCertificate = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.updateAuthorizedCertificate = + stubSimpleCall(expectedResponse); const [response] = await client.updateAuthorizedCertificate(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -490,12 +473,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes updateAuthorizedCertificate without error using callback', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.UpdateAuthorizedCertificateRequest() @@ -512,9 +494,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.AuthorizedCertificate() ); - client.innerApiCalls.updateAuthorizedCertificate = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateAuthorizedCertificate = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateAuthorizedCertificate( request, @@ -540,12 +521,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes updateAuthorizedCertificate with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.UpdateAuthorizedCertificateRequest() @@ -578,12 +558,11 @@ describe('v1.AuthorizedCertificatesClient', () => { describe('deleteAuthorizedCertificate', () => { it('invokes deleteAuthorizedCertificate without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.DeleteAuthorizedCertificateRequest() @@ -600,9 +579,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteAuthorizedCertificate = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.deleteAuthorizedCertificate = + stubSimpleCall(expectedResponse); const [response] = await client.deleteAuthorizedCertificate(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -613,12 +591,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes deleteAuthorizedCertificate without error using callback', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.DeleteAuthorizedCertificateRequest() @@ -635,9 +612,8 @@ describe('v1.AuthorizedCertificatesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteAuthorizedCertificate = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteAuthorizedCertificate = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteAuthorizedCertificate( request, @@ -663,12 +639,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes deleteAuthorizedCertificate with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.DeleteAuthorizedCertificateRequest() @@ -701,12 +676,11 @@ describe('v1.AuthorizedCertificatesClient', () => { describe('listAuthorizedCertificates', () => { it('invokes listAuthorizedCertificates without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -731,9 +705,8 @@ describe('v1.AuthorizedCertificatesClient', () => { new protos.google.appengine.v1.AuthorizedCertificate() ), ]; - client.innerApiCalls.listAuthorizedCertificates = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listAuthorizedCertificates = + stubSimpleCall(expectedResponse); const [response] = await client.listAuthorizedCertificates(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -744,12 +717,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes listAuthorizedCertificates without error using callback', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -774,9 +746,8 @@ describe('v1.AuthorizedCertificatesClient', () => { new protos.google.appengine.v1.AuthorizedCertificate() ), ]; - client.innerApiCalls.listAuthorizedCertificates = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listAuthorizedCertificates = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listAuthorizedCertificates( request, @@ -802,12 +773,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes listAuthorizedCertificates with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -838,12 +808,11 @@ describe('v1.AuthorizedCertificatesClient', () => { }); it('invokes listAuthorizedCertificatesStream without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -861,12 +830,12 @@ describe('v1.AuthorizedCertificatesClient', () => { new protos.google.appengine.v1.AuthorizedCertificate() ), ]; - client.descriptors.page.listAuthorizedCertificates.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listAuthorizedCertificates.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listAuthorizedCertificatesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.appengine.v1.AuthorizedCertificate[] = []; + const responses: protos.google.appengine.v1.AuthorizedCertificate[] = + []; stream.on( 'data', (response: protos.google.appengine.v1.AuthorizedCertificate) => { @@ -883,27 +852,28 @@ describe('v1.AuthorizedCertificatesClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listAuthorizedCertificates - .createStream as SinonStub) + ( + client.descriptors.page.listAuthorizedCertificates + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listAuthorizedCertificates, request) ); assert.strictEqual( - (client.descriptors.page.listAuthorizedCertificates - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedCertificates + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('invokes listAuthorizedCertificatesStream with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -911,13 +881,12 @@ describe('v1.AuthorizedCertificatesClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizedCertificates.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listAuthorizedCertificates.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listAuthorizedCertificatesStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.appengine.v1.AuthorizedCertificate[] = []; + const responses: protos.google.appengine.v1.AuthorizedCertificate[] = + []; stream.on( 'data', (response: protos.google.appengine.v1.AuthorizedCertificate) => { @@ -933,27 +902,28 @@ describe('v1.AuthorizedCertificatesClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listAuthorizedCertificates - .createStream as SinonStub) + ( + client.descriptors.page.listAuthorizedCertificates + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listAuthorizedCertificates, request) ); assert.strictEqual( - (client.descriptors.page.listAuthorizedCertificates - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedCertificates + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listAuthorizedCertificates without error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -971,9 +941,8 @@ describe('v1.AuthorizedCertificatesClient', () => { new protos.google.appengine.v1.AuthorizedCertificate() ), ]; - client.descriptors.page.listAuthorizedCertificates.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listAuthorizedCertificates.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IAuthorizedCertificate[] = []; const iterable = client.listAuthorizedCertificatesAsync(request); for await (const resource of iterable) { @@ -981,26 +950,27 @@ describe('v1.AuthorizedCertificatesClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listAuthorizedCertificates - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAuthorizedCertificates + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAuthorizedCertificates - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedCertificates + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); it('uses async iteration with listAuthorizedCertificates with error', async () => { - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); const request = generateSampleMessage( new protos.google.appengine.v1.ListAuthorizedCertificatesRequest() @@ -1008,27 +978,28 @@ describe('v1.AuthorizedCertificatesClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizedCertificates.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listAuthorizedCertificates.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listAuthorizedCertificatesAsync(request); await assert.rejects(async () => { - const responses: protos.google.appengine.v1.IAuthorizedCertificate[] = []; + const responses: protos.google.appengine.v1.IAuthorizedCertificate[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listAuthorizedCertificates - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAuthorizedCertificates + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAuthorizedCertificates - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedCertificates + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1043,12 +1014,11 @@ describe('v1.AuthorizedCertificatesClient', () => { version: 'versionValue', instance: 'instanceValue', }; - const client = new authorizedcertificatesModule.v1.AuthorizedCertificatesClient( - { + const client = + new authorizedcertificatesModule.v1.AuthorizedCertificatesClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - } - ); + }); client.initialize(); client.pathTemplates.instancePathTemplate.render = sinon .stub() diff --git a/packages/google-appengine/test/gapic_authorized_domains_v1.ts b/packages/google-appengine/test/gapic_authorized_domains_v1.ts index b9a8e5d96ac..a246b5d05a0 100644 --- a/packages/google-appengine/test/gapic_authorized_domains_v1.ts +++ b/packages/google-appengine/test/gapic_authorized_domains_v1.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; @@ -226,9 +225,8 @@ describe('v1.AuthorizedDomainsClient', () => { new protos.google.appengine.v1.AuthorizedDomain() ), ]; - client.innerApiCalls.listAuthorizedDomains = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listAuthorizedDomains = + stubSimpleCall(expectedResponse); const [response] = await client.listAuthorizedDomains(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -267,9 +265,8 @@ describe('v1.AuthorizedDomainsClient', () => { new protos.google.appengine.v1.AuthorizedDomain() ), ]; - client.innerApiCalls.listAuthorizedDomains = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listAuthorizedDomains = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listAuthorizedDomains( request, @@ -350,9 +347,8 @@ describe('v1.AuthorizedDomainsClient', () => { new protos.google.appengine.v1.AuthorizedDomain() ), ]; - client.descriptors.page.listAuthorizedDomains.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listAuthorizedDomains.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listAuthorizedDomainsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.AuthorizedDomain[] = []; @@ -372,16 +368,18 @@ describe('v1.AuthorizedDomainsClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listAuthorizedDomains - .createStream as SinonStub) + ( + client.descriptors.page.listAuthorizedDomains + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listAuthorizedDomains, request) ); assert.strictEqual( - (client.descriptors.page.listAuthorizedDomains - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedDomains + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -398,10 +396,8 @@ describe('v1.AuthorizedDomainsClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizedDomains.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listAuthorizedDomains.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listAuthorizedDomainsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.AuthorizedDomain[] = []; @@ -420,16 +416,18 @@ describe('v1.AuthorizedDomainsClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listAuthorizedDomains - .createStream as SinonStub) + ( + client.descriptors.page.listAuthorizedDomains + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listAuthorizedDomains, request) ); assert.strictEqual( - (client.descriptors.page.listAuthorizedDomains - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedDomains + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -456,9 +454,8 @@ describe('v1.AuthorizedDomainsClient', () => { new protos.google.appengine.v1.AuthorizedDomain() ), ]; - client.descriptors.page.listAuthorizedDomains.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listAuthorizedDomains.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IAuthorizedDomain[] = []; const iterable = client.listAuthorizedDomainsAsync(request); for await (const resource of iterable) { @@ -466,15 +463,17 @@ describe('v1.AuthorizedDomainsClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listAuthorizedDomains - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAuthorizedDomains + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAuthorizedDomains - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedDomains + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -491,10 +490,8 @@ describe('v1.AuthorizedDomainsClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listAuthorizedDomains.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listAuthorizedDomains.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listAuthorizedDomainsAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IAuthorizedDomain[] = []; @@ -503,15 +500,17 @@ describe('v1.AuthorizedDomainsClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listAuthorizedDomains - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listAuthorizedDomains + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listAuthorizedDomains - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listAuthorizedDomains + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-appengine/test/gapic_domain_mappings_v1.ts b/packages/google-appengine/test/gapic_domain_mappings_v1.ts index 585da86edfc..1ac7aaa4480 100644 --- a/packages/google-appengine/test/gapic_domain_mappings_v1.ts +++ b/packages/google-appengine/test/gapic_domain_mappings_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; 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; @@ -281,9 +280,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.DomainMapping() ); - client.innerApiCalls.getDomainMapping = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getDomainMapping = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getDomainMapping( request, @@ -362,9 +360,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDomainMapping = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createDomainMapping = + stubLongRunningCall(expectedResponse); const [operation] = await client.createDomainMapping(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -396,9 +393,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createDomainMapping = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createDomainMapping = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createDomainMapping( request, @@ -558,9 +554,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateDomainMapping = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateDomainMapping = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateDomainMapping(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -592,9 +587,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateDomainMapping = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateDomainMapping = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateDomainMapping( request, @@ -754,9 +748,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDomainMapping = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteDomainMapping = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteDomainMapping(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -788,9 +781,8 @@ describe('v1.DomainMappingsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteDomainMapping = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteDomainMapping = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteDomainMapping( request, @@ -952,9 +944,8 @@ describe('v1.DomainMappingsClient', () => { generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), ]; - client.innerApiCalls.listDomainMappings = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listDomainMappings = + stubSimpleCall(expectedResponse); const [response] = await client.listDomainMappings(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -987,9 +978,8 @@ describe('v1.DomainMappingsClient', () => { generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), ]; - client.innerApiCalls.listDomainMappings = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listDomainMappings = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listDomainMappings( request, @@ -1061,9 +1051,8 @@ describe('v1.DomainMappingsClient', () => { generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), ]; - client.descriptors.page.listDomainMappings.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listDomainMappings.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listDomainMappingsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.DomainMapping[] = []; @@ -1088,10 +1077,9 @@ describe('v1.DomainMappingsClient', () => { .calledWith(client.innerApiCalls.listDomainMappings, request) ); assert.strictEqual( - (client.descriptors.page.listDomainMappings - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDomainMappings.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1108,10 +1096,8 @@ describe('v1.DomainMappingsClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDomainMappings.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listDomainMappings.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listDomainMappingsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.DomainMapping[] = []; @@ -1135,10 +1121,9 @@ describe('v1.DomainMappingsClient', () => { .calledWith(client.innerApiCalls.listDomainMappings, request) ); assert.strictEqual( - (client.descriptors.page.listDomainMappings - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDomainMappings.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1159,9 +1144,8 @@ describe('v1.DomainMappingsClient', () => { generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), generateSampleMessage(new protos.google.appengine.v1.DomainMapping()), ]; - client.descriptors.page.listDomainMappings.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listDomainMappings.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IDomainMapping[] = []; const iterable = client.listDomainMappingsAsync(request); for await (const resource of iterable) { @@ -1169,15 +1153,15 @@ describe('v1.DomainMappingsClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listDomainMappings - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDomainMappings.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDomainMappings - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDomainMappings.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1194,10 +1178,8 @@ describe('v1.DomainMappingsClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listDomainMappings.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listDomainMappings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listDomainMappingsAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IDomainMapping[] = []; @@ -1206,15 +1188,15 @@ describe('v1.DomainMappingsClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listDomainMappings - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listDomainMappings.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listDomainMappings - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listDomainMappings.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-appengine/test/gapic_firewall_v1.ts b/packages/google-appengine/test/gapic_firewall_v1.ts index c71bbc42e47..0e0f930d379 100644 --- a/packages/google-appengine/test/gapic_firewall_v1.ts +++ b/packages/google-appengine/test/gapic_firewall_v1.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; @@ -216,9 +215,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.BatchUpdateIngressRulesResponse() ); - client.innerApiCalls.batchUpdateIngressRules = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.batchUpdateIngressRules = + stubSimpleCall(expectedResponse); const [response] = await client.batchUpdateIngressRules(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -249,9 +247,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.BatchUpdateIngressRulesResponse() ); - client.innerApiCalls.batchUpdateIngressRules = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.batchUpdateIngressRules = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.batchUpdateIngressRules( request, @@ -364,9 +361,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.FirewallRule() ); - client.innerApiCalls.createIngressRule = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createIngressRule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createIngressRule( request, @@ -476,9 +472,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.FirewallRule() ); - client.innerApiCalls.getIngressRule = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getIngressRule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getIngressRule( request, @@ -588,9 +583,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.FirewallRule() ); - client.innerApiCalls.updateIngressRule = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateIngressRule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateIngressRule( request, @@ -700,9 +694,8 @@ describe('v1.FirewallClient', () => { const expectedResponse = generateSampleMessage( new protos.google.protobuf.Empty() ); - client.innerApiCalls.deleteIngressRule = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteIngressRule = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteIngressRule( request, @@ -816,9 +809,8 @@ describe('v1.FirewallClient', () => { generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), ]; - client.innerApiCalls.listIngressRules = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listIngressRules = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listIngressRules( request, @@ -890,9 +882,8 @@ describe('v1.FirewallClient', () => { generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), ]; - client.descriptors.page.listIngressRules.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listIngressRules.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listIngressRulesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.FirewallRule[] = []; @@ -917,10 +908,9 @@ describe('v1.FirewallClient', () => { .calledWith(client.innerApiCalls.listIngressRules, request) ); assert.strictEqual( - (client.descriptors.page.listIngressRules - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listIngressRules.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -937,10 +927,8 @@ describe('v1.FirewallClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listIngressRules.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listIngressRules.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listIngressRulesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.FirewallRule[] = []; @@ -964,10 +952,9 @@ describe('v1.FirewallClient', () => { .calledWith(client.innerApiCalls.listIngressRules, request) ); assert.strictEqual( - (client.descriptors.page.listIngressRules - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listIngressRules.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -988,9 +975,8 @@ describe('v1.FirewallClient', () => { generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), generateSampleMessage(new protos.google.appengine.v1.FirewallRule()), ]; - client.descriptors.page.listIngressRules.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listIngressRules.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IFirewallRule[] = []; const iterable = client.listIngressRulesAsync(request); for await (const resource of iterable) { @@ -998,15 +984,15 @@ describe('v1.FirewallClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listIngressRules - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listIngressRules.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listIngressRules - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listIngressRules.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1023,10 +1009,8 @@ describe('v1.FirewallClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listIngressRules.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listIngressRules.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listIngressRulesAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IFirewallRule[] = []; @@ -1035,15 +1019,15 @@ describe('v1.FirewallClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listIngressRules - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listIngressRules.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listIngressRules - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listIngressRules.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-appengine/test/gapic_instances_v1.ts b/packages/google-appengine/test/gapic_instances_v1.ts index cc117f7a57e..eda4acd2b41 100644 --- a/packages/google-appengine/test/gapic_instances_v1.ts +++ b/packages/google-appengine/test/gapic_instances_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; 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; @@ -279,9 +278,8 @@ describe('v1.InstancesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.Instance() ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getInstance = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getInstance( request, @@ -360,9 +358,8 @@ describe('v1.InstancesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteInstance = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteInstance = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteInstance(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -394,9 +391,8 @@ describe('v1.InstancesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteInstance = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteInstance( request, @@ -556,9 +552,8 @@ describe('v1.InstancesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.debugInstance = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.debugInstance = + stubLongRunningCall(expectedResponse); const [operation] = await client.debugInstance(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -590,9 +585,8 @@ describe('v1.InstancesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.debugInstance = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.debugInstance = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.debugInstance( request, @@ -787,9 +781,8 @@ describe('v1.InstancesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Instance()), generateSampleMessage(new protos.google.appengine.v1.Instance()), ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listInstances = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listInstances( request, @@ -861,9 +854,8 @@ describe('v1.InstancesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Instance()), generateSampleMessage(new protos.google.appengine.v1.Instance()), ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listInstances.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listInstancesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.Instance[] = []; @@ -885,10 +877,9 @@ describe('v1.InstancesClient', () => { .calledWith(client.innerApiCalls.listInstances, request) ); assert.strictEqual( - (client.descriptors.page.listInstances - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listInstances.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -905,10 +896,8 @@ describe('v1.InstancesClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listInstances.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listInstancesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.Instance[] = []; @@ -929,10 +918,9 @@ describe('v1.InstancesClient', () => { .calledWith(client.innerApiCalls.listInstances, request) ); assert.strictEqual( - (client.descriptors.page.listInstances - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listInstances.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -953,9 +941,8 @@ describe('v1.InstancesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Instance()), generateSampleMessage(new protos.google.appengine.v1.Instance()), ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listInstances.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IInstance[] = []; const iterable = client.listInstancesAsync(request); for await (const resource of iterable) { @@ -963,15 +950,15 @@ describe('v1.InstancesClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listInstances - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listInstances - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -988,10 +975,8 @@ describe('v1.InstancesClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listInstances.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listInstancesAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IInstance[] = []; @@ -1000,15 +985,15 @@ describe('v1.InstancesClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listInstances - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listInstances - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-appengine/test/gapic_services_v1.ts b/packages/google-appengine/test/gapic_services_v1.ts index ab97bbe9483..84d35b840e0 100644 --- a/packages/google-appengine/test/gapic_services_v1.ts +++ b/packages/google-appengine/test/gapic_services_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; 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; @@ -279,9 +278,8 @@ describe('v1.ServicesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.Service() ); - client.innerApiCalls.getService = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getService = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getService( request, @@ -360,9 +358,8 @@ describe('v1.ServicesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateService = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateService = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateService(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -394,9 +391,8 @@ describe('v1.ServicesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateService = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateService = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateService( request, @@ -556,9 +552,8 @@ describe('v1.ServicesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteService = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteService = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteService(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -590,9 +585,8 @@ describe('v1.ServicesClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteService = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteService = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteService( request, @@ -787,9 +781,8 @@ describe('v1.ServicesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Service()), generateSampleMessage(new protos.google.appengine.v1.Service()), ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listServices = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listServices( request, @@ -861,9 +854,8 @@ describe('v1.ServicesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Service()), generateSampleMessage(new protos.google.appengine.v1.Service()), ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listServices.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listServicesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.Service[] = []; @@ -885,10 +877,9 @@ describe('v1.ServicesClient', () => { .calledWith(client.innerApiCalls.listServices, request) ); assert.strictEqual( - (client.descriptors.page.listServices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listServices.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -929,10 +920,9 @@ describe('v1.ServicesClient', () => { .calledWith(client.innerApiCalls.listServices, request) ); assert.strictEqual( - (client.descriptors.page.listServices - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listServices.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -953,9 +943,8 @@ describe('v1.ServicesClient', () => { generateSampleMessage(new protos.google.appengine.v1.Service()), generateSampleMessage(new protos.google.appengine.v1.Service()), ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IService[] = []; const iterable = client.listServicesAsync(request); for await (const resource of iterable) { @@ -963,15 +952,15 @@ describe('v1.ServicesClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -988,10 +977,8 @@ describe('v1.ServicesClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listServicesAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IService[] = []; @@ -1000,15 +987,15 @@ describe('v1.ServicesClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); diff --git a/packages/google-appengine/test/gapic_versions_v1.ts b/packages/google-appengine/test/gapic_versions_v1.ts index 496815a0f3a..44ca9481e56 100644 --- a/packages/google-appengine/test/gapic_versions_v1.ts +++ b/packages/google-appengine/test/gapic_versions_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; 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; @@ -279,9 +278,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.appengine.v1.Version() ); - client.innerApiCalls.getVersion = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getVersion = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getVersion( request, @@ -360,9 +358,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createVersion = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.createVersion = + stubLongRunningCall(expectedResponse); const [operation] = await client.createVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -394,9 +391,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.createVersion = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createVersion = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createVersion( request, @@ -556,9 +552,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateVersion = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.updateVersion = + stubLongRunningCall(expectedResponse); const [operation] = await client.updateVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -590,9 +585,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.updateVersion = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateVersion = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateVersion( request, @@ -752,9 +746,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteVersion = stubLongRunningCall( - expectedResponse - ); + client.innerApiCalls.deleteVersion = + stubLongRunningCall(expectedResponse); const [operation] = await client.deleteVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); @@ -786,9 +779,8 @@ describe('v1.VersionsClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteVersion = stubLongRunningCallWithCallback( - expectedResponse - ); + client.innerApiCalls.deleteVersion = + stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.deleteVersion( request, @@ -983,9 +975,8 @@ describe('v1.VersionsClient', () => { generateSampleMessage(new protos.google.appengine.v1.Version()), generateSampleMessage(new protos.google.appengine.v1.Version()), ]; - client.innerApiCalls.listVersions = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listVersions = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listVersions( request, @@ -1057,9 +1048,8 @@ describe('v1.VersionsClient', () => { generateSampleMessage(new protos.google.appengine.v1.Version()), generateSampleMessage(new protos.google.appengine.v1.Version()), ]; - client.descriptors.page.listVersions.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listVersions.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listVersionsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.appengine.v1.Version[] = []; @@ -1081,10 +1071,9 @@ describe('v1.VersionsClient', () => { .calledWith(client.innerApiCalls.listVersions, request) ); assert.strictEqual( - (client.descriptors.page.listVersions - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listVersions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1125,10 +1114,9 @@ describe('v1.VersionsClient', () => { .calledWith(client.innerApiCalls.listVersions, request) ); assert.strictEqual( - (client.descriptors.page.listVersions - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listVersions.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1149,9 +1137,8 @@ describe('v1.VersionsClient', () => { generateSampleMessage(new protos.google.appengine.v1.Version()), generateSampleMessage(new protos.google.appengine.v1.Version()), ]; - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.appengine.v1.IVersion[] = []; const iterable = client.listVersionsAsync(request); for await (const resource of iterable) { @@ -1159,15 +1146,15 @@ describe('v1.VersionsClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listVersions - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listVersions - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1184,10 +1171,8 @@ describe('v1.VersionsClient', () => { request.parent = ''; const expectedHeaderRequestParams = 'parent='; const expectedError = new Error('expected'); - client.descriptors.page.listVersions.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listVersionsAsync(request); await assert.rejects(async () => { const responses: protos.google.appengine.v1.IVersion[] = []; @@ -1196,15 +1181,15 @@ describe('v1.VersionsClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listVersions - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listVersions - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); });