@@ -56,10 +56,10 @@ - (void)testRaisesCollectionEvents {
5656 NSMutableArray <FSTViewSnapshot *> *otherAccum = [NSMutableArray array ];
5757
5858 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 );
6363
6464 FSTQueryListener *listener = [self listenToQuery: query accumulatingSnapshots: accum];
6565 FSTQueryListener *otherListener = [self listenToQuery: query accumulatingSnapshots: otherAccum];
@@ -91,7 +91,7 @@ - (void)testRaisesCollectionEvents {
9191 oldDocuments: [FSTDocumentSet documentSetWithComparator: snap2.query.comparator]
9292 documentChanges: @[ change1, change4 ]
9393 fromCache: snap2.fromCache
94- hasPendingWrites : snap2.hasPendingWrites
94+ mutatedKeys : snap2.mutatedKeys
9595 syncStateChanged: YES ];
9696 XCTAssertEqualObjects (otherAccum, (@[ expectedSnap2 ]));
9797}
@@ -133,8 +133,8 @@ - (void)testMutingAsyncListenerPreventsAllSubsequentEvents {
133133 NSMutableArray <FSTViewSnapshot *> *accum = [NSMutableArray array ];
134134
135135 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 );
138138
139139 __block FSTAsyncQueryListener *listener =
140140 [[FSTAsyncQueryListener alloc ] initWithExecutor: _executor.get ()
@@ -171,8 +171,8 @@ - (void)testDoesNotRaiseEventsForMetadataChangesUnlessSpecified {
171171 NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
172172
173173 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 );
176176
177177 FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: YES
178178 includeDocumentMetadataChanges: NO
@@ -207,10 +207,12 @@ - (void)testRaisesDocumentMetadataEventsOnlyWhenSpecified {
207207 NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
208208
209209 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);
214216
215217 FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
216218 includeDocumentMetadataChanges: YES
@@ -256,11 +258,15 @@ - (void)testRaisesQueryMetadataEventsOnlyWhenHasPendingWritesOnTheQueryChanges {
256258 NSMutableArray <FSTViewSnapshot *> *fullAccum = [NSMutableArray array ];
257259
258260 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);
264270
265271 FSTListenOptions *options = [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: YES
266272 includeDocumentMetadataChanges: NO
@@ -284,7 +290,7 @@ - (void)testRaisesQueryMetadataEventsOnlyWhenHasPendingWritesOnTheQueryChanges {
284290 oldDocuments: snap3.documents
285291 documentChanges: @[]
286292 fromCache: snap4.fromCache
287- hasPendingWrites: NO
293+ mutatedKeys: snap4.mutatedKeys
288294 syncStateChanged: snap4.syncStateChanged];
289295 XCTAssertEqualObjects (fullAccum, (@[ snap1, snap3, expectedSnap4 ]));
290296}
@@ -293,10 +299,12 @@ - (void)testMetadataOnlyDocumentChangesAreFilteredOutWhenIncludeDocumentMetadata
293299 NSMutableArray <FSTViewSnapshot *> *filteredAccum = [NSMutableArray array ];
294300
295301 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);
300308
301309 FSTQueryListener *filteredListener =
302310 [self listenToQuery: query accumulatingSnapshots: filteredAccum];
@@ -316,7 +324,7 @@ - (void)testMetadataOnlyDocumentChangesAreFilteredOutWhenIncludeDocumentMetadata
316324 oldDocuments: snap1.documents
317325 documentChanges: @[ change3 ]
318326 fromCache: snap2.isFromCache
319- hasPendingWrites : snap2.hasPendingWrites
327+ mutatedKeys : snap2.mutatedKeys
320328 syncStateChanged: snap2.syncStateChanged];
321329 XCTAssertEqualObjects (filteredAccum, (@[ snap1, expectedSnap2 ]));
322330}
@@ -325,8 +333,8 @@ - (void)testWillWaitForSyncIfOnline {
325333 NSMutableArray <FSTViewSnapshot *> *events = [NSMutableArray array ];
326334
327335 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 );
330338 FSTQueryListener *listener =
331339 [self listenToQuery: query
332340 options: [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
@@ -357,7 +365,7 @@ - (void)testWillWaitForSyncIfOnline {
357365 oldDocuments: [FSTDocumentSet documentSetWithComparator: snap3.query.comparator]
358366 documentChanges: @[ change1, change2 ]
359367 fromCache: NO
360- hasPendingWrites: NO
368+ mutatedKeys: snap3.mutatedKeys
361369 syncStateChanged: YES ];
362370 XCTAssertEqualObjects (events, (@[ expectedSnap ]));
363371}
@@ -366,8 +374,8 @@ - (void)testWillRaiseInitialEventWhenGoingOffline {
366374 NSMutableArray <FSTViewSnapshot *> *events = [NSMutableArray array ];
367375
368376 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 );
371379 FSTQueryListener *listener =
372380 [self listenToQuery: query
373381 options: [[FSTListenOptions alloc ] initWithIncludeQueryMetadataChanges: NO
@@ -396,14 +404,14 @@ - (void)testWillRaiseInitialEventWhenGoingOffline {
396404 oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
397405 documentChanges: @[ change1 ]
398406 fromCache: YES
399- hasPendingWrites: NO
407+ mutatedKeys: snap1.mutatedKeys
400408 syncStateChanged: YES ];
401409 FSTViewSnapshot *expectedSnap2 = [[FSTViewSnapshot alloc ] initWithQuery: query
402410 documents: snap2.documents
403411 oldDocuments: snap1.documents
404412 documentChanges: @[ change2 ]
405413 fromCache: YES
406- hasPendingWrites: NO
414+ mutatedKeys: snap2.mutatedKeys
407415 syncStateChanged: NO ];
408416 XCTAssertEqualObjects (events, (@[ expectedSnap1, expectedSnap2 ]));
409417}
@@ -429,7 +437,7 @@ - (void)testWillRaiseInitialEventWhenGoingOfflineAndThereAreNoDocs {
429437 oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
430438 documentChanges: @[]
431439 fromCache: YES
432- hasPendingWrites: NO
440+ mutatedKeys: snap1.mutatedKeys
433441 syncStateChanged: YES ];
434442 XCTAssertEqualObjects (events, (@[ expectedSnap ]));
435443}
@@ -454,7 +462,7 @@ - (void)testWillRaiseInitialEventWhenStartingOfflineAndThereAreNoDocs {
454462 oldDocuments: [FSTDocumentSet documentSetWithComparator: snap1.query.comparator]
455463 documentChanges: @[]
456464 fromCache: YES
457- hasPendingWrites: NO
465+ mutatedKeys: snap1.mutatedKeys
458466 syncStateChanged: YES ];
459467 XCTAssertEqualObjects (events, (@[ expectedSnap ]));
460468}
0 commit comments