@@ -1086,7 +1086,7 @@ apiDescribe('Database', (persistence: boolean) => {
1086
1086
1087
1087
// eslint-disable-next-line no-restricted-properties
1088
1088
( persistence ? it : it . skip ) (
1089
- 'can clear persistence if the client has not been initialized ' ,
1089
+ 'can clear persistence if the client has been terminated ' ,
1090
1090
async ( ) => {
1091
1091
await withTestDoc ( persistence , async docRef => {
1092
1092
const firestore = docRef . firestore ;
@@ -1108,6 +1108,29 @@ apiDescribe('Database', (persistence: boolean) => {
1108
1108
}
1109
1109
) ;
1110
1110
1111
+ // eslint-disable-next-line no-restricted-properties
1112
+ ( persistence ? it : it . skip ) (
1113
+ 'can clear persistence if the client has not been initialized' ,
1114
+ async ( ) => {
1115
+ await withTestDoc ( persistence , async docRef => {
1116
+ await docRef . set ( { foo : 'bar' } ) ;
1117
+ const app = docRef . firestore . app ;
1118
+ const name = app . name ;
1119
+ const options = app . options ;
1120
+
1121
+ await app . delete ( ) ;
1122
+ const app2 = firebase . initializeApp ( options , name ) ;
1123
+ const firestore2 = firebase . firestore ! ( app2 ) ;
1124
+ await firestore2 . clearPersistence ( ) ;
1125
+ await firestore2 . enablePersistence ( ) ;
1126
+ const docRef2 = firestore2 . doc ( docRef . path ) ;
1127
+ await expect (
1128
+ docRef2 . get ( { source : 'cache' } )
1129
+ ) . to . eventually . be . rejectedWith ( 'Failed to get document from cache.' ) ;
1130
+ } ) ;
1131
+ }
1132
+ ) ;
1133
+
1111
1134
// eslint-disable-next-line no-restricted-properties
1112
1135
( persistence ? it : it . skip ) (
1113
1136
'cannot clear persistence if the client has been initialized' ,
0 commit comments