File tree 2 files changed +22
-0
lines changed
packages/google-cloud-node
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,13 @@ Speech.detectEncoding_ = function(filename) {
161
161
* @private
162
162
*/
163
163
Speech . findFile_ = function ( file , callback ) {
164
+ if ( global . GCLOUD_SANDBOX_ENV ) {
165
+ callback ( null , {
166
+ content : new Buffer ( '' )
167
+ } ) ;
168
+ return ;
169
+ }
170
+
164
171
if ( common . util . isCustomType ( file , 'storage/file' ) ) {
165
172
// File is an instance of module:storage/file.
166
173
callback ( null , {
Original file line number Diff line number Diff line change @@ -211,6 +211,21 @@ describe('Speech', function() {
211
211
} ) ;
212
212
213
213
describe ( 'findFile_' , function ( ) {
214
+ it ( 'should return buffer for snippet sandbox' , function ( done ) {
215
+ global . GCLOUD_SANDBOX_ENV = true ;
216
+
217
+ Speech . findFile_ ( { } , function ( err , foundFile ) {
218
+ delete global . GCLOUD_SANDBOX_ENV ;
219
+ assert . ifError ( err ) ;
220
+
221
+ assert . deepEqual ( foundFile , {
222
+ content : new Buffer ( '' )
223
+ } ) ;
224
+
225
+ done ( ) ;
226
+ } ) ;
227
+ } ) ;
228
+
214
229
it ( 'should convert a File object' , function ( done ) {
215
230
var file = {
216
231
bucket : {
You can’t perform that action at this time.
0 commit comments