Skip to content

Commit 171bb39

Browse files
committed
Separate tests runTransaction unit tests
1 parent 4218bd4 commit 171bb39

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/unit/firestore.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,27 @@ describe('MockFirestore', function () {
125125
transaction.update(db.doc('doc'), {
126126
name: 'abc'
127127
});
128-
return 'cba';
129128
});
130-
}).then(function(transactionReturn) {
129+
}).then(function() {
131130
db.doc('doc').get().then(function(doc2) {
132131
expect(doc2.get('name')).to.equal('abc');
133-
expect(transactionReturn).to.equal('cba');
134132
done();
135133
}).catch(done);
136134
}).catch(done);
137135
}).catch(done);
138136
});
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+
});
139149
});
140150

141151
describe('#batch', function () {

0 commit comments

Comments
 (0)