@@ -991,6 +991,22 @@ describe('File', function() {
991991 writable . write ( 'data' ) ;
992992 } ) ;
993993
994+ it ( 'should re-emit response event' , function ( done ) {
995+ var writable = file . createWriteStream ( ) ;
996+ var resp = { } ;
997+
998+ file . startResumableUpload_ = function ( stream ) {
999+ stream . emit ( 'response' , resp ) ;
1000+ } ;
1001+
1002+ writable . on ( 'response' , function ( resp_ ) {
1003+ assert . strictEqual ( resp_ , resp ) ;
1004+ done ( ) ;
1005+ } ) ;
1006+
1007+ writable . write ( 'data' ) ;
1008+ } ) ;
1009+
9941010 it ( 'should cork data on prefinish' , function ( done ) {
9951011 var writable = file . createWriteStream ( ) ;
9961012
@@ -2020,13 +2036,32 @@ describe('File', function() {
20202036 file . startResumableUpload_ ( duplexify ( ) , metadata ) ;
20212037 } ) ;
20222038
2023- it ( 'should set the metadata from the response' , function ( done ) {
2039+ it ( 'should emit the response' , function ( done ) {
2040+ var resp = { } ;
2041+ var uploadStream = through ( ) ;
2042+
2043+ resumableUploadOverride = function ( ) {
2044+ setImmediate ( function ( ) {
2045+ uploadStream . emit ( 'response' , resp ) ;
2046+ } ) ;
2047+ return uploadStream ;
2048+ } ;
2049+
2050+ uploadStream . on ( 'response' , function ( resp_ ) {
2051+ assert . strictEqual ( resp_ , resp ) ;
2052+ done ( ) ;
2053+ } ) ;
2054+
2055+ file . startResumableUpload_ ( duplexify ( ) ) ;
2056+ } ) ;
2057+
2058+ it ( 'should set the metadata from the metadata event' , function ( done ) {
20242059 var metadata = { } ;
20252060 var uploadStream = through ( ) ;
20262061
20272062 resumableUploadOverride = function ( ) {
20282063 setImmediate ( function ( ) {
2029- uploadStream . emit ( 'response' , null , metadata ) ;
2064+ uploadStream . emit ( 'metadata' , metadata ) ;
20302065
20312066 setImmediate ( function ( ) {
20322067 assert . strictEqual ( file . metadata , metadata ) ;
@@ -2036,7 +2071,6 @@ describe('File', function() {
20362071 return uploadStream ;
20372072 } ;
20382073
2039-
20402074 file . startResumableUpload_ ( duplexify ( ) ) ;
20412075 } ) ;
20422076
0 commit comments