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