@@ -26,10 +26,9 @@ import * as phishingprotectionservicev1beta1Module from '../src';
26
26
import { protobuf } from 'google-gax' ;
27
27
28
28
function generateSampleMessage < T extends object > ( instance : T ) {
29
- const filledObject = ( instance . constructor as typeof protobuf . Message ) . toObject (
30
- instance as protobuf . Message < T > ,
31
- { defaults : true }
32
- ) ;
29
+ const filledObject = (
30
+ instance . constructor as typeof protobuf . Message
31
+ ) . toObject ( instance as protobuf . Message < T > , { defaults : true } ) ;
33
32
return ( instance . constructor as typeof protobuf . Message ) . fromObject (
34
33
filledObject
35
34
) as T ;
@@ -74,49 +73,54 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
74
73
} ) ;
75
74
76
75
it ( 'should create a client with no option' , ( ) => {
77
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client ( ) ;
76
+ const client =
77
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client ( ) ;
78
78
assert ( client ) ;
79
79
} ) ;
80
80
81
81
it ( 'should create a client with gRPC fallback' , ( ) => {
82
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
83
- {
84
- fallback : true ,
85
- }
86
- ) ;
82
+ const client =
83
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
84
+ {
85
+ fallback : true ,
86
+ }
87
+ ) ;
87
88
assert ( client ) ;
88
89
} ) ;
89
90
90
91
it ( 'has initialize method and supports deferred initialization' , async ( ) => {
91
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
92
- {
93
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
94
- projectId : 'bogus' ,
95
- }
96
- ) ;
92
+ const client =
93
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
94
+ {
95
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
96
+ projectId : 'bogus' ,
97
+ }
98
+ ) ;
97
99
assert . strictEqual ( client . phishingProtectionServiceV1Beta1Stub , undefined ) ;
98
100
await client . initialize ( ) ;
99
101
assert ( client . phishingProtectionServiceV1Beta1Stub ) ;
100
102
} ) ;
101
103
102
104
it ( 'has close method' , ( ) => {
103
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
104
- {
105
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
106
- projectId : 'bogus' ,
107
- }
108
- ) ;
105
+ const client =
106
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
107
+ {
108
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
109
+ projectId : 'bogus' ,
110
+ }
111
+ ) ;
109
112
client . close ( ) ;
110
113
} ) ;
111
114
112
115
it ( 'has getProjectId method' , async ( ) => {
113
116
const fakeProjectId = 'fake-project-id' ;
114
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
115
- {
116
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
117
- projectId : 'bogus' ,
118
- }
119
- ) ;
117
+ const client =
118
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
119
+ {
120
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
121
+ projectId : 'bogus' ,
122
+ }
123
+ ) ;
120
124
client . auth . getProjectId = sinon . stub ( ) . resolves ( fakeProjectId ) ;
121
125
const result = await client . getProjectId ( ) ;
122
126
assert . strictEqual ( result , fakeProjectId ) ;
@@ -125,12 +129,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
125
129
126
130
it ( 'has getProjectId method with callback' , async ( ) => {
127
131
const fakeProjectId = 'fake-project-id' ;
128
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
129
- {
130
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
131
- projectId : 'bogus' ,
132
- }
133
- ) ;
132
+ const client =
133
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
134
+ {
135
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
136
+ projectId : 'bogus' ,
137
+ }
138
+ ) ;
134
139
client . auth . getProjectId = sinon
135
140
. stub ( )
136
141
. callsArgWith ( 0 , null , fakeProjectId ) ;
@@ -149,12 +154,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
149
154
150
155
describe ( 'reportPhishing' , ( ) => {
151
156
it ( 'invokes reportPhishing without error' , async ( ) => {
152
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
153
- {
154
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
155
- projectId : 'bogus' ,
156
- }
157
- ) ;
157
+ const client =
158
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
159
+ {
160
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
161
+ projectId : 'bogus' ,
162
+ }
163
+ ) ;
158
164
client . initialize ( ) ;
159
165
const request = generateSampleMessage (
160
166
new protos . google . cloud . phishingprotection . v1beta1 . ReportPhishingRequest ( )
@@ -182,12 +188,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
182
188
} ) ;
183
189
184
190
it ( 'invokes reportPhishing without error using callback' , async ( ) => {
185
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
186
- {
187
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
188
- projectId : 'bogus' ,
189
- }
190
- ) ;
191
+ const client =
192
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
193
+ {
194
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
195
+ projectId : 'bogus' ,
196
+ }
197
+ ) ;
191
198
client . initialize ( ) ;
192
199
const request = generateSampleMessage (
193
200
new protos . google . cloud . phishingprotection . v1beta1 . ReportPhishingRequest ( )
@@ -204,9 +211,8 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
204
211
const expectedResponse = generateSampleMessage (
205
212
new protos . google . cloud . phishingprotection . v1beta1 . ReportPhishingResponse ( )
206
213
) ;
207
- client . innerApiCalls . reportPhishing = stubSimpleCallWithCallback (
208
- expectedResponse
209
- ) ;
214
+ client . innerApiCalls . reportPhishing =
215
+ stubSimpleCallWithCallback ( expectedResponse ) ;
210
216
const promise = new Promise ( ( resolve , reject ) => {
211
217
client . reportPhishing (
212
218
request ,
@@ -232,12 +238,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
232
238
} ) ;
233
239
234
240
it ( 'invokes reportPhishing with error' , async ( ) => {
235
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
236
- {
237
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
238
- projectId : 'bogus' ,
239
- }
240
- ) ;
241
+ const client =
242
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
243
+ {
244
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
245
+ projectId : 'bogus' ,
246
+ }
247
+ ) ;
241
248
client . initialize ( ) ;
242
249
const request = generateSampleMessage (
243
250
new protos . google . cloud . phishingprotection . v1beta1 . ReportPhishingRequest ( )
@@ -271,12 +278,13 @@ describe('v1beta1.PhishingProtectionServiceV1Beta1Client', () => {
271
278
const expectedParameters = {
272
279
project : 'projectValue' ,
273
280
} ;
274
- const client = new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
275
- {
276
- credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
277
- projectId : 'bogus' ,
278
- }
279
- ) ;
281
+ const client =
282
+ new phishingprotectionservicev1beta1Module . v1beta1 . PhishingProtectionServiceV1Beta1Client (
283
+ {
284
+ credentials : { client_email : 'bogus' , private_key : 'bogus' } ,
285
+ projectId : 'bogus' ,
286
+ }
287
+ ) ;
280
288
client . initialize ( ) ;
281
289
client . pathTemplates . projectPathTemplate . render = sinon
282
290
. stub ( )
0 commit comments