@@ -113,101 +113,103 @@ function stubAsyncIterationCall<ResponseType>(
113
113
}
114
114
115
115
describe ( 'v1.DashboardsServiceClient' , ( ) => {
116
- it ( 'has servicePath' , ( ) => {
117
- const servicePath =
118
- dashboardsserviceModule . v1 . DashboardsServiceClient . servicePath ;
119
- assert ( servicePath ) ;
120
- } ) ;
121
-
122
- it ( 'has apiEndpoint' , ( ) => {
123
- const apiEndpoint =
124
- dashboardsserviceModule . v1 . DashboardsServiceClient . apiEndpoint ;
125
- assert ( apiEndpoint ) ;
126
- } ) ;
127
-
128
- it ( 'has port' , ( ) => {
129
- const port = dashboardsserviceModule . v1 . DashboardsServiceClient . port ;
130
- assert ( port ) ;
131
- assert ( typeof port === 'number' ) ;
132
- } ) ;
133
-
134
- it ( 'should create a client with no option' , ( ) => {
135
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( ) ;
136
- assert ( client ) ;
137
- } ) ;
116
+ describe ( 'Common methods' , ( ) => {
117
+ it ( 'has servicePath' , ( ) => {
118
+ const servicePath =
119
+ dashboardsserviceModule . v1 . DashboardsServiceClient . servicePath ;
120
+ assert ( servicePath ) ;
121
+ } ) ;
138
122
139
- it ( 'should create a client with gRPC fallback' , ( ) => {
140
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
141
- fallback : true ,
123
+ it ( 'has apiEndpoint' , ( ) => {
124
+ const apiEndpoint =
125
+ dashboardsserviceModule . v1 . DashboardsServiceClient . apiEndpoint ;
126
+ assert ( apiEndpoint ) ;
142
127
} ) ;
143
- assert ( client ) ;
144
- } ) ;
145
128
146
- it ( 'has initialize method and supports deferred initialization' , async ( ) => {
147
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
148
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
149
- projectId : 'bogus' ,
129
+ it ( 'has port' , ( ) => {
130
+ const port = dashboardsserviceModule . v1 . DashboardsServiceClient . port ;
131
+ assert ( port ) ;
132
+ assert ( typeof port === 'number' ) ;
150
133
} ) ;
151
- assert . strictEqual ( client . dashboardsServiceStub , undefined ) ;
152
- await client . initialize ( ) ;
153
- assert ( client . dashboardsServiceStub ) ;
154
- } ) ;
155
134
156
- it ( 'has close method for the initialized client' , done => {
157
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
158
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
159
- projectId : 'bogus' ,
135
+ it ( 'should create a client with no option' , ( ) => {
136
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( ) ;
137
+ assert ( client ) ;
160
138
} ) ;
161
- client . initialize ( ) ;
162
- assert ( client . dashboardsServiceStub ) ;
163
- client . close ( ) . then ( ( ) => {
164
- done ( ) ;
139
+
140
+ it ( 'should create a client with gRPC fallback' , ( ) => {
141
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
142
+ fallback : true ,
143
+ } ) ;
144
+ assert ( client ) ;
165
145
} ) ;
166
- } ) ;
167
146
168
- it ( 'has close method for the non-initialized client' , done => {
169
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
170
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
171
- projectId : 'bogus' ,
147
+ it ( 'has initialize method and supports deferred initialization' , async ( ) => {
148
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
149
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
150
+ projectId : 'bogus' ,
151
+ } ) ;
152
+ assert . strictEqual ( client . dashboardsServiceStub , undefined ) ;
153
+ await client . initialize ( ) ;
154
+ assert ( client . dashboardsServiceStub ) ;
172
155
} ) ;
173
- assert . strictEqual ( client . dashboardsServiceStub , undefined ) ;
174
- client . close ( ) . then ( ( ) => {
175
- done ( ) ;
156
+
157
+ it ( 'has close method for the initialized client' , done => {
158
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
159
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
160
+ projectId : 'bogus' ,
161
+ } ) ;
162
+ client . initialize ( ) ;
163
+ assert ( client . dashboardsServiceStub ) ;
164
+ client . close ( ) . then ( ( ) => {
165
+ done ( ) ;
166
+ } ) ;
176
167
} ) ;
177
- } ) ;
178
168
179
- it ( 'has getProjectId method' , async ( ) => {
180
- const fakeProjectId = 'fake-project-id' ;
181
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
182
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
183
- projectId : 'bogus' ,
169
+ it ( 'has close method for the non-initialized client' , done => {
170
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
171
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
172
+ projectId : 'bogus' ,
173
+ } ) ;
174
+ assert . strictEqual ( client . dashboardsServiceStub , undefined ) ;
175
+ client . close ( ) . then ( ( ) => {
176
+ done ( ) ;
177
+ } ) ;
184
178
} ) ;
185
- client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
186
- const result = await client . getProjectId ( ) ;
187
- assert . strictEqual ( result , fakeProjectId ) ;
188
- assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
189
- } ) ;
190
179
191
- it ( 'has getProjectId method with callback' , async ( ) => {
192
- const fakeProjectId = 'fake-project-id' ;
193
- const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
194
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
195
- projectId : 'bogus' ,
180
+ it ( 'has getProjectId method' , async ( ) => {
181
+ const fakeProjectId = 'fake-project-id' ;
182
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
183
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
184
+ projectId : 'bogus' ,
185
+ } ) ;
186
+ client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
187
+ const result = await client . getProjectId ( ) ;
188
+ assert . strictEqual ( result , fakeProjectId ) ;
189
+ assert ( ( client . auth . getProjectId as SinonStub ) . calledWithExactly ( ) ) ;
196
190
} ) ;
197
- client . auth . getProjectId = sinon
198
- . stub ( )
199
- . callsArgWith ( 0 , null , fakeProjectId ) ;
200
- const promise = new Promise ( ( resolve , reject ) => {
201
- client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
202
- if ( err ) {
203
- reject ( err ) ;
204
- } else {
205
- resolve ( projectId ) ;
206
- }
191
+
192
+ it ( 'has getProjectId method with callback' , async ( ) => {
193
+ const fakeProjectId = 'fake-project-id' ;
194
+ const client = new dashboardsserviceModule . v1 . DashboardsServiceClient ( {
195
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
196
+ projectId : 'bogus' ,
197
+ } ) ;
198
+ client . auth . getProjectId = sinon
199
+ . stub ( )
200
+ . callsArgWith ( 0 , null , fakeProjectId ) ;
201
+ const promise = new Promise ( ( resolve , reject ) => {
202
+ client . getProjectId ( ( err ?: Error | null , projectId ?: string | null ) => {
203
+ if ( err ) {
204
+ reject ( err ) ;
205
+ } else {
206
+ resolve ( projectId ) ;
207
+ }
208
+ } ) ;
207
209
} ) ;
210
+ const result = await promise ;
211
+ assert . strictEqual ( result , fakeProjectId ) ;
208
212
} ) ;
209
- const result = await promise ;
210
- assert . strictEqual ( result , fakeProjectId ) ;
211
213
} ) ;
212
214
213
215
describe ( 'createDashboard' , ( ) => {
0 commit comments