File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import {
34
34
} from './helpers/util' ;
35
35
36
36
import '../index' ;
37
+ import { Deferred } from '@firebase/util' ;
37
38
38
39
describe ( 'Transaction Tests' , ( ) => {
39
40
// Tests that use hijackHash() should set restoreHash to the restore function
@@ -561,6 +562,8 @@ describe('Transaction Tests', () => {
561
562
562
563
await node . child ( 'foo' ) . set ( 5 ) ;
563
564
565
+ const deferred = new Deferred < void > ( ) ;
566
+
564
567
// 'foo' gets overwritten in the update so the transaction gets cancelled.
565
568
node . child ( 'foo' ) . transaction (
566
569
old => {
@@ -569,7 +572,7 @@ describe('Transaction Tests', () => {
569
572
( error , committed , snapshot ) => {
570
573
expect ( error . message ) . to . equal ( 'set' ) ;
571
574
expect ( committed ) . to . equal ( false ) ;
572
- fooTransactionDone = true ;
575
+ deferred . resolve ( ) ;
573
576
}
574
577
) ;
575
578
@@ -595,7 +598,7 @@ describe('Transaction Tests', () => {
595
598
}
596
599
} ) ;
597
600
598
- expect ( fooTransactionDone ) . to . equal ( true ) ;
601
+ await deferred . promise ;
599
602
expect ( barTransactionDone ) . to . equal ( false ) ;
600
603
restoreHash ( ) ;
601
604
restoreHash = null ;
You can’t perform that action at this time.
0 commit comments