@@ -50,124 +50,132 @@ function stubSimpleCallWithCallback<ResponseType>(
5050}
5151
5252describe ( 'v1beta1.PhishingProtectionServiceV1Beta1Client' , ( ) => {
53- it ( 'has servicePath' , ( ) => {
54- const servicePath =
55- phishingprotectionservicev1beta1Module . v1beta1
56- . PhishingProtectionServiceV1Beta1Client . servicePath ;
57- assert ( servicePath ) ;
58- } ) ;
53+ describe ( 'Common methods' , ( ) => {
54+ it ( 'has servicePath' , ( ) => {
55+ const servicePath =
56+ phishingprotectionservicev1beta1Module . v1beta1
57+ . PhishingProtectionServiceV1Beta1Client . servicePath ;
58+ assert ( servicePath ) ;
59+ } ) ;
5960
60- it ( 'has apiEndpoint' , ( ) => {
61- const apiEndpoint =
62- phishingprotectionservicev1beta1Module . v1beta1
63- . PhishingProtectionServiceV1Beta1Client . apiEndpoint ;
64- assert ( apiEndpoint ) ;
65- } ) ;
61+ it ( 'has apiEndpoint' , ( ) => {
62+ const apiEndpoint =
63+ phishingprotectionservicev1beta1Module . v1beta1
64+ . PhishingProtectionServiceV1Beta1Client . apiEndpoint ;
65+ assert ( apiEndpoint ) ;
66+ } ) ;
6667
67- it ( 'has port' , ( ) => {
68- const port =
69- phishingprotectionservicev1beta1Module . v1beta1
70- . PhishingProtectionServiceV1Beta1Client . port ;
71- assert ( port ) ;
72- assert ( typeof port === 'number' ) ;
73- } ) ;
68+ it ( 'has port' , ( ) => {
69+ const port =
70+ phishingprotectionservicev1beta1Module . v1beta1
71+ . PhishingProtectionServiceV1Beta1Client . port ;
72+ assert ( port ) ;
73+ assert ( typeof port === 'number' ) ;
74+ } ) ;
7475
75- it ( 'should create a client with no option' , ( ) => {
76- const client =
77- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client ( ) ;
78- assert ( client ) ;
79- } ) ;
76+ it ( 'should create a client with no option' , ( ) => {
77+ const client =
78+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client ( ) ;
79+ assert ( client ) ;
80+ } ) ;
8081
81- it ( 'should create a client with gRPC fallback' , ( ) => {
82- const client =
83- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
84- {
85- fallback : true ,
86- }
87- ) ;
88- assert ( client ) ;
89- } ) ;
82+ it ( 'should create a client with gRPC fallback' , ( ) => {
83+ const client =
84+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
85+ {
86+ fallback : true ,
87+ }
88+ ) ;
89+ assert ( client ) ;
90+ } ) ;
9091
91- it ( 'has initialize method and supports deferred initialization' , async ( ) => {
92- const client =
93- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
94- {
95- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
96- projectId : 'bogus' ,
97- }
92+ it ( 'has initialize method and supports deferred initialization' , async ( ) => {
93+ const client =
94+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
95+ {
96+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
97+ projectId : 'bogus' ,
98+ }
99+ ) ;
100+ assert . strictEqual (
101+ client . phishingProtectionServiceV1Beta1Stub ,
102+ undefined
98103 ) ;
99- assert . strictEqual ( client . phishingProtectionServiceV1Beta1Stub , undefined ) ;
100- await client . initialize ( ) ;
101- assert ( client . phishingProtectionServiceV1Beta1Stub ) ;
102- } ) ;
104+ await client . initialize ( ) ;
105+ assert ( client . phishingProtectionServiceV1Beta1Stub ) ;
106+ } ) ;
103107
104- it ( 'has close method for the initialized client' , done => {
105- const client =
106- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
107- {
108- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
109- projectId : 'bogus' ,
110- }
111- ) ;
112- client . initialize ( ) ;
113- assert ( client . phishingProtectionServiceV1Beta1Stub ) ;
114- client . close ( ) . then ( ( ) => {
115- done ( ) ;
108+ it ( 'has close method for the initialized client' , done => {
109+ const client =
110+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
111+ {
112+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
113+ projectId : 'bogus' ,
114+ }
115+ ) ;
116+ client . initialize ( ) ;
117+ assert ( client . phishingProtectionServiceV1Beta1Stub ) ;
118+ client . close ( ) . then ( ( ) => {
119+ done ( ) ;
120+ } ) ;
116121 } ) ;
117- } ) ;
118122
119- it ( 'has close method for the non-initialized client' , done => {
120- const client =
121- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
122- {
123- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
124- projectId : 'bogus' ,
125- }
123+ it ( 'has close method for the non-initialized client' , done => {
124+ const client =
125+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
126+ {
127+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
128+ projectId : 'bogus' ,
129+ }
130+ ) ;
131+ assert . strictEqual (
132+ client . phishingProtectionServiceV1Beta1Stub ,
133+ undefined
126134 ) ;
127- assert . strictEqual ( client . phishingProtectionServiceV1Beta1Stub , undefined ) ;
128- client . close ( ) . then ( ( ) => {
129- done ( ) ;
135+ client . close ( ) . then ( ( ) => {
136+ done ( ) ;
137+ } ) ;
130138 } ) ;
131- } ) ;
132139
133- it ( 'has getProjectId method' , async ( ) => {
134- const fakeProjectId = 'fake-project-id' ;
135- const client =
136- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
137- {
138- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
139- projectId : 'bogus' ,
140- }
141- ) ;
142- client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
143- const result = await client . getProjectId ( ) ;
144- assert . strictEqual ( result , fakeProjectId ) ;
145- assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
146- } ) ;
140+ it ( 'has getProjectId method' , async ( ) => {
141+ const fakeProjectId = 'fake-project-id' ;
142+ const client =
143+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
144+ {
145+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
146+ projectId : 'bogus' ,
147+ }
148+ ) ;
149+ client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
150+ const result = await client . getProjectId ( ) ;
151+ assert . strictEqual ( result , fakeProjectId ) ;
152+ assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
153+ } ) ;
147154
148- it ( 'has getProjectId method with callback' , async ( ) => {
149- const fakeProjectId = 'fake-project-id' ;
150- const client =
151- new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
152- {
153- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
154- projectId : 'bogus' ,
155- }
156- ) ;
157- client . auth . getProjectId = sinon
158- . stub ( )
159- . callsArgWith ( 0 , null , fakeProjectId ) ;
160- const promise = new Promise ( ( resolve , reject ) => {
161- client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
162- if ( err ) {
163- reject ( err ) ;
164- } else {
165- resolve ( projectId ) ;
166- }
155+ it ( 'has getProjectId method with callback' , async ( ) => {
156+ const fakeProjectId = 'fake-project-id' ;
157+ const client =
158+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
159+ {
160+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
161+ projectId : 'bogus' ,
162+ }
163+ ) ;
164+ client . auth . getProjectId = sinon
165+ . stub ( )
166+ . callsArgWith ( 0 , null , fakeProjectId ) ;
167+ const promise = new Promise ( ( resolve , reject ) => {
168+ client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
169+ if ( err ) {
170+ reject ( err ) ;
171+ } else {
172+ resolve ( projectId ) ;
173+ }
174+ } ) ;
167175 } ) ;
176+ const result = await promise ;
177+ assert . strictEqual ( result , fakeProjectId ) ;
168178 } ) ;
169- const result = await promise ;
170- assert . strictEqual ( result , fakeProjectId ) ;
171179 } ) ;
172180
173181 describe ( 'reportPhishing' , ( ) => {
0 commit comments