File tree Expand file tree Collapse file tree
packages/google-cloud-speech Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,6 +161,13 @@ Speech.detectEncoding_ = function(filename) {
161161 * @private
162162 */
163163Speech . findFile_ = function ( file , callback ) {
164+ if ( global . GCLOUD_SANDBOX_ENV ) {
165+ callback ( null , {
166+ content : new Buffer ( '' )
167+ } ) ;
168+ return ;
169+ }
170+
164171 if ( common . util . isCustomType ( file , 'storage/file' ) ) {
165172 // File is an instance of module:storage/file.
166173 callback ( null , {
Original file line number Diff line number Diff line change @@ -211,6 +211,21 @@ describe('Speech', function() {
211211 } ) ;
212212
213213 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+
214229 it ( 'should convert a File object' , function ( done ) {
215230 var file = {
216231 bucket : {
You can’t perform that action at this time.
0 commit comments