@@ -448,22 +448,20 @@ describe('Speech', function() {
448
448
449
449
stream . setPipeline = util . noop ;
450
450
451
- speech . requestWritableStream = function ( ) {
452
- requestStream = through . obj ( ) ;
453
- return requestStream ;
451
+ speech . api . Speech = {
452
+ streamingRecognize : function ( ) {
453
+ requestStream = through . obj ( ) ;
454
+ return requestStream ;
455
+ }
454
456
} ;
455
457
} ) ;
456
458
457
459
it ( 'should make the correct request once writing started' , function ( done ) {
458
- speech . requestWritableStream = function ( protoOpts ) {
459
- assert . deepEqual ( protoOpts , {
460
- service : 'Speech' ,
461
- method : 'streamingRecognize'
462
- } ) ;
463
-
464
- setImmediate ( done ) ;
465
-
466
- return through . obj ( ) ;
460
+ speech . api . Speech = {
461
+ streamingRecognize : function ( ) {
462
+ setImmediate ( done ) ;
463
+ return through . obj ( ) ;
464
+ }
467
465
} ;
468
466
469
467
stream . emit ( 'writing' ) ;
@@ -477,31 +475,35 @@ describe('Speech', function() {
477
475
done ( ) ;
478
476
} ) ;
479
477
480
- speech . requestWritableStream = function ( ) {
481
- var requestStream = through . obj ( ) ;
478
+ speech . api . Speech = {
479
+ streamingRecognize : function ( ) {
480
+ var requestStream = through . obj ( ) ;
482
481
483
- setImmediate ( function ( ) {
484
- requestStream . emit ( 'response' , response ) ;
485
- } ) ;
482
+ setImmediate ( function ( ) {
483
+ requestStream . emit ( 'response' , response ) ;
484
+ } ) ;
486
485
487
- return requestStream ;
486
+ return requestStream ;
487
+ }
488
488
} ;
489
489
490
490
stream . emit ( 'writing' ) ;
491
491
} ) ;
492
492
493
493
it ( 'should send the initial write to the request stream' , function ( done ) {
494
- speech . requestWritableStream = function ( ) {
495
- var requestStream = through . obj ( ) ;
494
+ speech . api . Speech = {
495
+ streamingRecognize : function ( ) {
496
+ var requestStream = through . obj ( ) ;
496
497
497
- requestStream . once ( 'data' , function ( data ) {
498
- assert . deepEqual ( data , {
499
- streamingConfig : CONFIG
498
+ requestStream . once ( 'data' , function ( data ) {
499
+ assert . deepEqual ( data , {
500
+ streamingConfig : CONFIG
501
+ } ) ;
502
+ done ( ) ;
500
503
} ) ;
501
- done ( ) ;
502
- } ) ;
503
504
504
- return requestStream ;
505
+ return requestStream ;
506
+ }
505
507
} ;
506
508
507
509
stream . emit ( 'writing' ) ;
@@ -582,17 +584,19 @@ describe('Speech', function() {
582
584
verbose : true
583
585
} ) ;
584
586
585
- speech . requestWritableStream = function ( ) {
586
- var stream = through . obj ( ) ;
587
+ speech . api . Speech = {
588
+ streamingRecognize : function ( ) {
589
+ var stream = through . obj ( ) ;
587
590
588
- stream . on ( 'data' , function ( data ) {
589
- assert . deepEqual ( data , {
590
- streamingConfig : { } // No `verbose` property.
591
+ stream . on ( 'data' , function ( data ) {
592
+ assert . deepEqual ( data , {
593
+ streamingConfig : { } // No `verbose` property.
594
+ } ) ;
595
+ done ( ) ;
591
596
} ) ;
592
- done ( ) ;
593
- } ) ;
594
597
595
- return stream ;
598
+ return stream ;
599
+ }
596
600
} ;
597
601
598
602
stream . emit ( 'writing' ) ;
0 commit comments