@@ -46,7 +46,7 @@ import {
46
46
IndexKind ,
47
47
IndexOffset
48
48
} from '../../../src/model/field_index' ;
49
- import { Mutation } from '../../../src/model/mutation' ;
49
+ import { Mutation , MutationType } from '../../../src/model/mutation' ;
50
50
import { MutationBatch } from '../../../src/model/mutation_batch' ;
51
51
import { RemoteEvent } from '../../../src/remote/remote_event' ;
52
52
import {
@@ -156,7 +156,11 @@ class AsyncLocalStoreTester {
156
156
) ;
157
157
}
158
158
159
- assertOverlaysRead ( byKey : number , byCollection : number ) : void {
159
+ assertOverlaysRead (
160
+ byKey : number ,
161
+ byCollection : number ,
162
+ overlayTypes : { [ k : string ] : MutationType }
163
+ ) : void {
160
164
expect ( this . queryEngine . overlaysReadByCollection ) . to . equal (
161
165
byCollection ,
162
166
'Overlays read (by collection)'
@@ -165,6 +169,10 @@ class AsyncLocalStoreTester {
165
169
byKey ,
166
170
'Overlays read (by key)'
167
171
) ;
172
+ expect ( this . queryEngine . overlayTypes ) . to . deep . equal (
173
+ overlayTypes ,
174
+ 'Overlay types read'
175
+ ) ;
168
176
}
169
177
170
178
assertQueryReturned ( ...keys : string [ ] ) : void {
@@ -354,7 +362,10 @@ describe('LocalStore w/ IndexedDB Persistence (Non generic)', () => {
354
362
355
363
const queryMatches = query ( 'coll' , filter ( 'matches' , '==' , true ) ) ;
356
364
await test . executeQuery ( queryMatches ) ;
357
- test . assertOverlaysRead ( 1 , 1 ) ;
365
+ test . assertOverlaysRead ( 1 , 1 , {
366
+ [ key ( 'coll/a' ) . toString ( ) ] : MutationType . Set ,
367
+ [ key ( 'coll/b' ) . toString ( ) ] : MutationType . Set
368
+ } ) ;
358
369
test . assertQueryReturned ( 'coll/a' , 'coll/b' ) ;
359
370
} ) ;
360
371
@@ -390,7 +401,9 @@ describe('LocalStore w/ IndexedDB Persistence (Non generic)', () => {
390
401
// The query engine first reads the documents by key and then re-runs the query without limit.
391
402
await test . executeQuery ( queryCount ) ;
392
403
test . assertRemoteDocumentsRead ( 5 , 0 ) ;
393
- test . assertOverlaysRead ( 5 , 1 ) ;
404
+ test . assertOverlaysRead ( 5 , 1 , {
405
+ [ key ( 'coll/b' ) . toString ( ) ] : MutationType . Delete
406
+ } ) ;
394
407
test . assertQueryReturned ( 'coll/a' , 'coll/c' ) ;
395
408
} ) ;
396
409
@@ -423,7 +436,7 @@ describe('LocalStore w/ IndexedDB Persistence (Non generic)', () => {
423
436
424
437
await test . executeQuery ( queryCount ) ;
425
438
test . assertRemoteDocumentsRead ( 2 , 0 ) ;
426
- test . assertOverlaysRead ( 2 , 0 ) ;
439
+ test . assertOverlaysRead ( 2 , 0 , { } ) ;
427
440
test . assertQueryReturned ( 'coll/a' , 'coll/c' ) ;
428
441
} ) ;
429
442
@@ -441,7 +454,9 @@ describe('LocalStore w/ IndexedDB Persistence (Non generic)', () => {
441
454
442
455
const queryTime = query ( 'coll' , orderBy ( 'time' , 'asc' ) ) ;
443
456
await test . executeQuery ( queryTime ) ;
444
- test . assertOverlaysRead ( 1 , 0 ) ;
457
+ test . assertOverlaysRead ( 1 , 0 , {
458
+ [ key ( 'coll/a' ) . toString ( ) ] : MutationType . Set
459
+ } ) ;
445
460
test . assertQueryReturned ( 'coll/a' ) ;
446
461
} ) ;
447
462
} ) ;
0 commit comments