@@ -145,101 +145,103 @@ function stubAsyncIterationCall<ResponseType>(
145145}
146146
147147describe ( 'v1.DatastoreAdminClient' , ( ) => {
148- it ( 'has servicePath' , ( ) => {
149- const servicePath =
150- datastoreadminModule . v1 . DatastoreAdminClient . servicePath ;
151- assert ( servicePath ) ;
152- } ) ;
153-
154- it ( 'has apiEndpoint' , ( ) => {
155- const apiEndpoint =
156- datastoreadminModule . v1 . DatastoreAdminClient . apiEndpoint ;
157- assert ( apiEndpoint ) ;
158- } ) ;
159-
160- it ( 'has port' , ( ) => {
161- const port = datastoreadminModule . v1 . DatastoreAdminClient . port ;
162- assert ( port ) ;
163- assert ( typeof port === 'number' ) ;
164- } ) ;
165-
166- it ( 'should create a client with no option' , ( ) => {
167- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( ) ;
168- assert ( client ) ;
169- } ) ;
148+ describe ( 'Common methods' , ( ) => {
149+ it ( 'has servicePath' , ( ) => {
150+ const servicePath =
151+ datastoreadminModule . v1 . DatastoreAdminClient . servicePath ;
152+ assert ( servicePath ) ;
153+ } ) ;
170154
171- it ( 'should create a client with gRPC fallback' , ( ) => {
172- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
173- fallback : true ,
155+ it ( 'has apiEndpoint' , ( ) => {
156+ const apiEndpoint =
157+ datastoreadminModule . v1 . DatastoreAdminClient . apiEndpoint ;
158+ assert ( apiEndpoint ) ;
174159 } ) ;
175- assert ( client ) ;
176- } ) ;
177160
178- it ( 'has initialize method and supports deferred initialization' , async ( ) => {
179- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
180- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
181- projectId : 'bogus' ,
161+ it ( 'has port' , ( ) => {
162+ const port = datastoreadminModule . v1 . DatastoreAdminClient . port ;
163+ assert ( port ) ;
164+ assert ( typeof port === 'number' ) ;
182165 } ) ;
183- assert . strictEqual ( client . datastoreAdminStub , undefined ) ;
184- await client . initialize ( ) ;
185- assert ( client . datastoreAdminStub ) ;
186- } ) ;
187166
188- it ( 'has close method for the initialized client' , done => {
189- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
190- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
191- projectId : 'bogus' ,
167+ it ( 'should create a client with no option' , ( ) => {
168+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( ) ;
169+ assert ( client ) ;
192170 } ) ;
193- client . initialize ( ) ;
194- assert ( client . datastoreAdminStub ) ;
195- client . close ( ) . then ( ( ) => {
196- done ( ) ;
171+
172+ it ( 'should create a client with gRPC fallback' , ( ) => {
173+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
174+ fallback : true ,
175+ } ) ;
176+ assert ( client ) ;
197177 } ) ;
198- } ) ;
199178
200- it ( 'has close method for the non-initialized client' , done => {
201- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
202- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
203- projectId : 'bogus' ,
179+ it ( 'has initialize method and supports deferred initialization' , async ( ) => {
180+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
181+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
182+ projectId : 'bogus' ,
183+ } ) ;
184+ assert . strictEqual ( client . datastoreAdminStub , undefined ) ;
185+ await client . initialize ( ) ;
186+ assert ( client . datastoreAdminStub ) ;
204187 } ) ;
205- assert . strictEqual ( client . datastoreAdminStub , undefined ) ;
206- client . close ( ) . then ( ( ) => {
207- done ( ) ;
188+
189+ it ( 'has close method for the initialized client' , done => {
190+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
191+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
192+ projectId : 'bogus' ,
193+ } ) ;
194+ client . initialize ( ) ;
195+ assert ( client . datastoreAdminStub ) ;
196+ client . close ( ) . then ( ( ) => {
197+ done ( ) ;
198+ } ) ;
208199 } ) ;
209- } ) ;
210200
211- it ( 'has getProjectId method' , async ( ) => {
212- const fakeProjectId = 'fake-project-id' ;
213- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
214- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
215- projectId : 'bogus' ,
201+ it ( 'has close method for the non-initialized client' , done => {
202+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
203+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
204+ projectId : 'bogus' ,
205+ } ) ;
206+ assert . strictEqual ( client . datastoreAdminStub , undefined ) ;
207+ client . close ( ) . then ( ( ) => {
208+ done ( ) ;
209+ } ) ;
216210 } ) ;
217- client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
218- const result = await client . getProjectId ( ) ;
219- assert . strictEqual ( result , fakeProjectId ) ;
220- assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
221- } ) ;
222211
223- it ( 'has getProjectId method with callback' , async ( ) => {
224- const fakeProjectId = 'fake-project-id' ;
225- const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
226- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
227- projectId : 'bogus' ,
212+ it ( 'has getProjectId method' , async ( ) => {
213+ const fakeProjectId = 'fake-project-id' ;
214+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
215+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
216+ projectId : 'bogus' ,
217+ } ) ;
218+ client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
219+ const result = await client . getProjectId ( ) ;
220+ assert . strictEqual ( result , fakeProjectId ) ;
221+ assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
228222 } ) ;
229- client . auth . getProjectId = sinon
230- . stub ( )
231- . callsArgWith ( 0 , null , fakeProjectId ) ;
232- const promise = new Promise ( ( resolve , reject ) => {
233- client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
234- if ( err ) {
235- reject ( err ) ;
236- } else {
237- resolve ( projectId ) ;
238- }
223+
224+ it ( 'has getProjectId method with callback' , async ( ) => {
225+ const fakeProjectId = 'fake-project-id' ;
226+ const client = new datastoreadminModule . v1 . DatastoreAdminClient ( {
227+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
228+ projectId : 'bogus' ,
229+ } ) ;
230+ client . auth . getProjectId = sinon
231+ . stub ( )
232+ . callsArgWith ( 0 , null , fakeProjectId ) ;
233+ const promise = new Promise ( ( resolve , reject ) => {
234+ client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
235+ if ( err ) {
236+ reject ( err ) ;
237+ } else {
238+ resolve ( projectId ) ;
239+ }
240+ } ) ;
239241 } ) ;
242+ const result = await promise ;
243+ assert . strictEqual ( result , fakeProjectId ) ;
240244 } ) ;
241- const result = await promise ;
242- assert . strictEqual ( result , fakeProjectId ) ;
243245 } ) ;
244246
245247 describe ( 'getIndex' , ( ) => {
0 commit comments