@@ -1710,37 +1710,45 @@ apiDescribe('Database', (persistence: boolean) => {
1710
1710
} ) ;
1711
1711
1712
1712
it ( 'can keep docs separate with multi-db when online' , ( ) => {
1713
- return withNamedTestDbsOrSkipUnlessUsingEmulator ( persistence , [ 'db1' , 'db2' ] , async ( [ db1 , db2 ] ) => {
1714
- const data = { name :
'Rafi' , email :
'[email protected] ' } ;
1713
+ return withNamedTestDbsOrSkipUnlessUsingEmulator (
1714
+ persistence ,
1715
+ [ 'db1' , 'db2' ] ,
1716
+ async ( [ db1 , db2 ] ) => {
1717
+ const data = { name :
'Rafi' , email :
'[email protected] ' } ;
1715
1718
1716
- const ref1 = await doc ( collection ( db1 , 'users' ) , 'doc1' ) ;
1717
- await setDoc ( ref1 , data ) ;
1718
- const snapshot1 = await getDoc ( ref1 ) ;
1719
- expect ( snapshot1 . exists ( ) ) . to . be . ok ;
1720
- expect ( snapshot1 . data ( ) ) . to . be . deep . equals ( data ) ;
1719
+ const ref1 = await doc ( collection ( db1 , 'users' ) , 'doc1' ) ;
1720
+ await setDoc ( ref1 , data ) ;
1721
+ const snapshot1 = await getDoc ( ref1 ) ;
1722
+ expect ( snapshot1 . exists ( ) ) . to . be . ok ;
1723
+ expect ( snapshot1 . data ( ) ) . to . be . deep . equals ( data ) ;
1721
1724
1722
- const ref2 = await doc ( collection ( db2 , 'users' ) , 'doc1' ) ;
1723
- const snapshot2 = await getDocFromServer ( ref2 ) ;
1724
- expect ( snapshot2 . exists ( ) ) . to . not . be . ok ;
1725
- } ) ;
1725
+ const ref2 = await doc ( collection ( db2 , 'users' ) , 'doc1' ) ;
1726
+ const snapshot2 = await getDocFromServer ( ref2 ) ;
1727
+ expect ( snapshot2 . exists ( ) ) . to . not . be . ok ;
1728
+ }
1729
+ ) ;
1726
1730
} ) ;
1727
1731
1728
1732
it ( 'can keep docs separate with multi-db when offline' , ( ) => {
1729
- return withNamedTestDbsOrSkipUnlessUsingEmulator ( persistence , [ 'db1' , 'db2' ] , async ( [ db1 , db2 ] ) => {
1730
- await disableNetwork ( db1 ) ;
1731
- await disableNetwork ( db2 ) ;
1732
- const data = { name :
'Rafi' , email :
'[email protected] ' } ;
1733
-
1734
- const ref1 = await doc ( collection ( db1 , 'users' ) ) ;
1735
- void setDoc ( ref1 , data ) ;
1736
- const snapshot = await getDocFromCache ( ref1 ) ;
1737
- expect ( snapshot . exists ( ) ) . to . be . ok ;
1738
- expect ( snapshot . data ( ) ) . to . be . deep . equals ( data ) ;
1739
-
1740
- const ref2 = await doc ( collection ( db2 , 'users' ) ) ;
1741
- await expect ( getDocFromCache ( ref2 ) ) . to . eventually . rejectedWith (
1742
- 'Failed to get document from cache.'
1743
- ) ;
1744
- } ) ;
1733
+ return withNamedTestDbsOrSkipUnlessUsingEmulator (
1734
+ persistence ,
1735
+ [ 'db1' , 'db2' ] ,
1736
+ async ( [ db1 , db2 ] ) => {
1737
+ await disableNetwork ( db1 ) ;
1738
+ await disableNetwork ( db2 ) ;
1739
+ const data = { name :
'Rafi' , email :
'[email protected] ' } ;
1740
+
1741
+ const ref1 = await doc ( collection ( db1 , 'users' ) ) ;
1742
+ void setDoc ( ref1 , data ) ;
1743
+ const snapshot = await getDocFromCache ( ref1 ) ;
1744
+ expect ( snapshot . exists ( ) ) . to . be . ok ;
1745
+ expect ( snapshot . data ( ) ) . to . be . deep . equals ( data ) ;
1746
+
1747
+ const ref2 = await doc ( collection ( db2 , 'users' ) ) ;
1748
+ await expect ( getDocFromCache ( ref2 ) ) . to . eventually . rejectedWith (
1749
+ 'Failed to get document from cache.'
1750
+ ) ;
1751
+ }
1752
+ ) ;
1745
1753
} ) ;
1746
1754
} ) ;
0 commit comments