@@ -519,14 +519,16 @@ apiDescribe('Database', persistence => {
519519 asyncIt ( 'can queue writes while offline' , ( ) => {
520520 return withTestDb ( persistence , db => {
521521 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 ;
523525
524- return firestoreClient
526+ return firestoreInternal
525527 . disableNetwork ( )
526528 . then ( ( ) => {
527529 return Promise . all ( [
528530 docRef . set ( { foo : 'bar' } ) ,
529- firestoreClient . enableNetwork ( )
531+ firestoreInternal . enableNetwork ( )
530532 ] ) ;
531533 } )
532534 . then ( ( ) => docRef . get ( ) )
@@ -539,14 +541,16 @@ apiDescribe('Database', persistence => {
539541 asyncIt ( 'can get documents while offline' , ( ) => {
540542 return withTestDb ( persistence , db => {
541543 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 ;
543547
544- return firestoreClient . disableNetwork ( ) . then ( ( ) => {
548+ return firestoreInternal . disableNetwork ( ) . then ( ( ) => {
545549 const writePromise = docRef . set ( { foo : 'bar' } ) ;
546550
547551 return docRef . get ( ) . then ( snapshot => {
548552 expect ( snapshot . metadata . fromCache ) . to . be . true ;
549- return firestoreClient . enableNetwork ( ) . then ( ( ) => {
553+ return firestoreInternal . enableNetwork ( ) . then ( ( ) => {
550554 return writePromise . then ( ( ) => {
551555 docRef . get ( ) . then ( doc => {
552556 expect ( snapshot . metadata . fromCache ) . to . be . false ;
0 commit comments