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