@@ -56,10 +56,10 @@ - (void)testRaisesCollectionEvents {
56
56
NSMutableArray <FSTViewSnapshot *> *otherAccum = [NSMutableArray array ];
57
57
58
58
FSTQuery *query = FSTTestQuery (" rooms" );
59
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
60
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
61
- FSTDocument *doc2prime =
62
- FSTTestDoc ( " rooms/Hades " , 3 , @{ @" name " : @" Hades " , @" owner " : @" Jonny " }, NO );
59
+ FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced );
60
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced );
61
+ FSTDocument *doc2prime = FSTTestDoc ( " rooms/Hades " , 3 , @{ @" name " : @" Hades " , @" owner " : @" Jonny " },
62
+ FSTDocumentStateSynced );
63
63
64
64
FSTQueryListener *listener = [self listenToQuery: query accumulatingSnapshots: accum];
65
65
FSTQueryListener *otherListener = [self listenToQuery: query accumulatingSnapshots: otherAccum];
@@ -91,7 +91,7 @@ - (void)testRaisesCollectionEvents {
91
91
oldDocuments: [FSTDocumentSet documentSetWithComparator: snap2.query.comparator]
92
92
documentChanges: @[ change1, change4 ]
93
93
fromCache: snap2.fromCache
94
- hasPendingWrites : snap2.hasPendingWrites
94
+ mutatedKeys : snap2.mutatedKeys
95
95
syncStateChanged: YES ];
96
96
XCTAssertEqualObjects (otherAccum, (@[ expectedSnap2 ]));
97
97
}
@@ -133,8 +133,8 @@ - (void)testMutingAsyncListenerPreventsAllSubsequentEvents {
133
133
NSMutableArray <FSTViewSnapshot *> *accum = [NSMutableArray array ];
134
134
135
135
FSTQuery *query = FSTTestQuery (" rooms/Eros" );
136
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 3 , @{@" name" : @" Eros" }, NO );
137
- FSTDocument *doc2 = FSTTestDoc (" rooms/Eros" , 4 , @{@" name" : @" Eros2" }, NO );
136
+ FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 3 , @{@" name" : @" Eros" }, FSTDocumentStateSynced );
137
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Eros" , 4 , @{@" name" : @" Eros2" }, FSTDocumentStateSynced );
138
138
139
139
__block FSTAsyncQueryListener *listener =
140
140
[[FSTAsyncQueryListener alloc ] initWithExecutor: _executor.get ()
@@ -171,8 +171,8 @@ - (void)testDoesNotRaiseEventsForMetadataChangesUnlessSpecified {
171
171
NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
172
172
173
173
FSTQuery *query = FSTTestQuery (" rooms" );
174
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
175
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
174
+ FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced );
175
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced );
176
176
177
177
FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: YES
178
178
includeDocumentMetadataChanges: NO
@@ -207,10 +207,12 @@ - (void)testRaisesDocumentMetadataEventsOnlyWhenSpecified {
207
207
NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
208
208
209
209
FSTQuery *query = FSTTestQuery (" rooms" );
210
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, YES );
211
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
212
- FSTDocument *doc1Prime = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
213
- FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, NO );
210
+ FSTDocument *doc1 =
211
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateLocalMutations);
212
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced);
213
+ FSTDocument *doc1Prime =
214
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced);
215
+ FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, FSTDocumentStateSynced);
214
216
215
217
FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
216
218
includeDocumentMetadataChanges: YES
@@ -256,11 +258,15 @@ - (void)testRaisesQueryMetadataEventsOnlyWhenHasPendingWritesOnTheQueryChanges {
256
258
NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
257
259
258
260
FSTQuery *query = FSTTestQuery (" rooms" );
259
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, YES );
260
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, YES );
261
- FSTDocument *doc1Prime = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
262
- FSTDocument *doc2Prime = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
263
- FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, NO );
261
+ FSTDocument *doc1 =
262
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateLocalMutations);
263
+ FSTDocument *doc2 =
264
+ FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateLocalMutations);
265
+ FSTDocument *doc1Prime =
266
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced);
267
+ FSTDocument *doc2Prime =
268
+ FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced);
269
+ FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, FSTDocumentStateSynced);
264
270
265
271
FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: YES
266
272
includeDocumentMetadataChanges: NO
@@ -284,7 +290,7 @@ - (void)testRaisesQueryMetadataEventsOnlyWhenHasPendingWritesOnTheQueryChanges {
284
290
oldDocuments: snap3.documents
285
291
documentChanges: @[]
286
292
fromCache: snap4.fromCache
287
- hasPendingWrites: NO
293
+ mutatedKeys: snap4.mutatedKeys
288
294
syncStateChanged: snap4.syncStateChanged];
289
295
XCTAssertEqualObjects (fullAccum, (@[ snap1, snap3, expectedSnap4 ]));
290
296
}
@@ -293,10 +299,12 @@ - (void)testMetadataOnlyDocumentChangesAreFilteredOutWhenIncludeDocumentMetadata
293
299
NSMutableArray <FSTViewSnapshot *> *filteredAccum = [NSMutableArray array ];
294
300
295
301
FSTQuery *query = FSTTestQuery (" rooms" );
296
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, YES );
297
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
298
- FSTDocument *doc1Prime = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
299
- FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, NO );
302
+ FSTDocument *doc1 =
303
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateLocalMutations);
304
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced);
305
+ FSTDocument *doc1Prime =
306
+ FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced);
307
+ FSTDocument *doc3 = FSTTestDoc (" rooms/Other" , 3 , @{@" name" : @" Other" }, FSTDocumentStateSynced);
300
308
301
309
FSTQueryListener *filteredListener =
302
310
[self listenToQuery: query accumulatingSnapshots: filteredAccum];
@@ -316,7 +324,7 @@ - (void)testMetadataOnlyDocumentChangesAreFilteredOutWhenIncludeDocumentMetadata
316
324
oldDocuments: snap1.documents
317
325
documentChanges: @[ change3 ]
318
326
fromCache: snap2.isFromCache
319
- hasPendingWrites : snap2.hasPendingWrites
327
+ mutatedKeys : snap2.mutatedKeys
320
328
syncStateChanged: snap2.syncStateChanged];
321
329
XCTAssertEqualObjects (filteredAccum, (@[ snap1, expectedSnap2 ]));
322
330
}
@@ -325,8 +333,8 @@ - (void)testWillWaitForSyncIfOnline {
325
333
NSMutableArray <FSTViewSnapshot *> *events = [NSMutableArray array ];
326
334
327
335
FSTQuery *query = FSTTestQuery (" rooms" );
328
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
329
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
336
+ FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced );
337
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced );
330
338
FSTQueryListener *listener =
331
339
[self listenToQuery: query
332
340
options: [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
@@ -357,7 +365,7 @@ - (void)testWillWaitForSyncIfOnline {
357
365
oldDocuments: [FSTDocumentSet documentSetWithComparator: snap3.query.comparator]
358
366
documentChanges: @[ change1, change2 ]
359
367
fromCache: NO
360
- hasPendingWrites: NO
368
+ mutatedKeys: snap3.mutatedKeys
361
369
syncStateChanged: YES ];
362
370
XCTAssertEqualObjects (events, (@[ expectedSnap ]));
363
371
}
@@ -366,8 +374,8 @@ - (void)testWillRaiseInitialEventWhenGoingOffline {
366
374
NSMutableArray <FSTViewSnapshot *> *events = [NSMutableArray array ];
367
375
368
376
FSTQuery *query = FSTTestQuery (" rooms" );
369
- FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, NO );
370
- FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, NO );
377
+ FSTDocument *doc1 = FSTTestDoc (" rooms/Eros" , 1 , @{@" name" : @" Eros" }, FSTDocumentStateSynced );
378
+ FSTDocument *doc2 = FSTTestDoc (" rooms/Hades" , 2 , @{@" name" : @" Hades" }, FSTDocumentStateSynced );
371
379
FSTQueryListener *listener =
372
380
[self listenToQuery: query
373
381
options: [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
@@ -396,14 +404,14 @@ - (void)testWillRaiseInitialEventWhenGoingOffline {
396
404
oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
397
405
documentChanges: @[ change1 ]
398
406
fromCache: YES
399
- hasPendingWrites: NO
407
+ mutatedKeys: snap1.mutatedKeys
400
408
syncStateChanged: YES ];
401
409
FSTViewSnapshot *expectedSnap2 = [[FSTViewSnapshot alloc ] initWithQuery: query
402
410
documents: snap2.documents
403
411
oldDocuments: snap1.documents
404
412
documentChanges: @[ change2 ]
405
413
fromCache: YES
406
- hasPendingWrites: NO
414
+ mutatedKeys: snap2.mutatedKeys
407
415
syncStateChanged: NO ];
408
416
XCTAssertEqualObjects (events, (@[ expectedSnap1, expectedSnap2 ]));
409
417
}
@@ -429,7 +437,7 @@ - (void)testWillRaiseInitialEventWhenGoingOfflineAndThereAreNoDocs {
429
437
oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
430
438
documentChanges: @[]
431
439
fromCache: YES
432
- hasPendingWrites: NO
440
+ mutatedKeys: snap1.mutatedKeys
433
441
syncStateChanged: YES ];
434
442
XCTAssertEqualObjects (events, (@[ expectedSnap ]));
435
443
}
@@ -454,7 +462,7 @@ - (void)testWillRaiseInitialEventWhenStartingOfflineAndThereAreNoDocs {
454
462
oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
455
463
documentChanges: @[]
456
464
fromCache: YES
457
- hasPendingWrites: NO
465
+ mutatedKeys: snap1.mutatedKeys
458
466
syncStateChanged: YES ];
459
467
XCTAssertEqualObjects (events, (@[ expectedSnap ]));
460
468
}
0 commit comments