File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -72,8 +72,13 @@ MockFirestore.prototype.runTransaction = function(transFunc) {
7272 return doc . get ( ) ;
7373 } ;
7474 return new Promise ( function ( resolve , reject ) {
75- transFunc ( batch ) . then ( function ( ) {
76- batch . commit ( ) . then ( resolve ) . catch ( reject ) ;
75+ Promise . resolve ( transFunc ( batch ) ) . then ( function ( value ) {
76+ batch
77+ . commit ( )
78+ . then ( function ( ) {
79+ resolve ( value ) ;
80+ } )
81+ . catch ( reject ) ;
7782 } ) . catch ( reject ) ;
7883 } ) ;
7984} ;
Original file line number Diff line number Diff line change @@ -134,6 +134,18 @@ describe('MockFirestore', function () {
134134 } ) . catch ( done ) ;
135135 } ) . catch ( done ) ;
136136 } ) ;
137+
138+ it ( 'returns the return value of the passed function' , function ( ) {
139+ db . autoFlush ( ) ;
140+
141+ return db . runTransaction ( function ( transaction ) {
142+ return transaction . get ( db . doc ( 'doc' ) ) . then ( function ( ) {
143+ return 'cba' ;
144+ } ) ;
145+ } ) . then ( function ( transactionReturn ) {
146+ expect ( transactionReturn ) . to . equal ( 'cba' ) ;
147+ } ) ;
148+ } ) ;
137149 } ) ;
138150
139151 describe ( '#batch' , function ( ) {
You can’t perform that action at this time.
0 commit comments