@@ -519,14 +519,16 @@ apiDescribe('Database', persistence => {
519
519
asyncIt ( 'can queue writes while offline' , ( ) => {
520
520
return withTestDb ( persistence , db => {
521
521
const docRef = db . collection ( 'rooms' ) . doc ( ) ;
522
- const firestoreClient = ( docRef . firestore as Firestore ) . _firestoreClient ;
522
+ // TODO(mikelehen): Find better way to expose this to tests.
523
+ // tslint:disable-next-line:no-any enableNetwork isn't exposed via d.ts
524
+ const firestoreInternal = docRef . firestore . INTERNAL as any ;
523
525
524
- return firestoreClient
526
+ return firestoreInternal
525
527
. disableNetwork ( )
526
528
. then ( ( ) => {
527
529
return Promise . all ( [
528
530
docRef . set ( { foo : 'bar' } ) ,
529
- firestoreClient . enableNetwork ( )
531
+ firestoreInternal . enableNetwork ( )
530
532
] ) ;
531
533
} )
532
534
. then ( ( ) => docRef . get ( ) )
@@ -539,14 +541,16 @@ apiDescribe('Database', persistence => {
539
541
asyncIt ( 'can get documents while offline' , ( ) => {
540
542
return withTestDb ( persistence , db => {
541
543
const docRef = db . collection ( 'rooms' ) . doc ( ) ;
542
- const firestoreClient = ( docRef . firestore as Firestore ) . _firestoreClient ;
544
+ // TODO(mikelehen): Find better way to expose this to tests.
545
+ // tslint:disable-next-line:no-any enableNetwork isn't exposed via d.ts
546
+ const firestoreInternal = docRef . firestore . INTERNAL as any ;
543
547
544
- return firestoreClient . disableNetwork ( ) . then ( ( ) => {
548
+ return firestoreInternal . disableNetwork ( ) . then ( ( ) => {
545
549
const writePromise = docRef . set ( { foo : 'bar' } ) ;
546
550
547
551
return docRef . get ( ) . then ( snapshot => {
548
552
expect ( snapshot . metadata . fromCache ) . to . be . true ;
549
- return firestoreClient . enableNetwork ( ) . then ( ( ) => {
553
+ return firestoreInternal . enableNetwork ( ) . then ( ( ) => {
550
554
return writePromise . then ( ( ) => {
551
555
docRef . get ( ) . then ( doc => {
552
556
expect ( snapshot . metadata . fromCache ) . to . be . false ;
0 commit comments