@@ -283,6 +283,35 @@ describeSpec('Listens:', [], () => {
283
283
) ;
284
284
} ) ;
285
285
286
+ specTest ( 'Deleted documents in cache are fixed' , [ 'exclusive' ] , ( ) => {
287
+ const allQuery = Query . atPath ( path ( 'collection' ) ) ;
288
+ const docAv1 = doc ( 'collection/a' , 1000 , { key : 'a' } ) ;
289
+ const docDeleted = deletedDoc ( 'collection/a' , 2000 ) ;
290
+
291
+ return spec ( )
292
+ // Presuppose an initial state where the remote document cache has a
293
+ // broken synthesized delete at a timestamp later than the true version
294
+ // of the document.
295
+ . withGCEnabled ( false )
296
+ . userListens ( allQuery )
297
+ . watchAcksFull ( allQuery , 1000 , docAv1 )
298
+ . expectEvents ( allQuery , { added : [ docAv1 ] , fromCache : false } )
299
+ . watchSends ( { removed : [ allQuery ] } , docDeleted )
300
+ . watchCurrents ( allQuery , 'resume-token-2000' )
301
+ . watchSnapshots ( 2000 )
302
+ . expectEvents ( allQuery , { removed : [ docAv1 ] , fromCache : false } )
303
+ . userUnlistens ( allQuery )
304
+ . watchRemoves ( allQuery )
305
+ . restart ( )
306
+
307
+ // Now when the client listens expect the cached NoDocument to be
308
+ // discarded because the global snapshot version exceeds what came before.
309
+ . userListens ( allQuery , 'resume-token-2000' )
310
+ . watchAcksFull ( allQuery , 3000 , docAv1 )
311
+ . expectEvents ( allQuery , { added : [ docAv1 ] , fromCache : false } )
312
+ ;
313
+ } ) ;
314
+
286
315
specTest ( 'Listens are reestablished after network disconnect' , [ ] , ( ) => {
287
316
const expectRequestCount = requestCounts =>
288
317
requestCounts . addTarget + requestCounts . removeTarget ;
0 commit comments