Skip to content

Commit 27ade69

Browse files
committed
FIRQueryTests.mm: begin porting resumingAQueryShouldUseExistenceFilterToDetectDeletes from firebase/firebase-android-sdk#4799
1 parent 9aaa3d2 commit 27ade69

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Firestore/Example/Tests/Integration/API/FIRQueryTests.mm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,4 +1180,28 @@ - (void)testOrderByEquality {
11801180
matchesResult:@[ @"doc6", @"doc3" ]];
11811181
}
11821182

1183+
- (void)resumingAQueryShouldUseExistenceFilterToDetectDeletes {
1184+
// Prepare the names and contents of the 100 documents to create.
1185+
NSMutableDictionary<NSString*, NSDictionary<NSString *, id>*>* testData = [[NSMutableDictionary alloc] init];
1186+
for (int i=0; i<100; i++) {
1187+
[testData setValue:@{@"key": @42} forKey:[NSString stringWithFormat:@"doc%@", @(i)]];
1188+
}
1189+
1190+
// Create 100 documents in a new collection.
1191+
FIRCollectionReference *collRef = [self collectionRefWithDocuments:testData];
1192+
1193+
// Run a query to populate the local cache with the 100 documents and a resume token.
1194+
NSArray<FIRDocumentReference*>* createdDocuments;
1195+
{
1196+
FIRQuerySnapshot *querySnapshot = [self readDocumentSetForRef:collRef source:FIRFirestoreSourceDefault];
1197+
NSMutableArray<FIRDocumentReference*>* createdDocumentsAccumulator = [[NSMutableArray alloc] init];
1198+
for (FIRDocumentSnapshot* documentSnapshot in querySnapshot.documents) {
1199+
[createdDocumentsAccumulator addObject:documentSnapshot.reference];
1200+
}
1201+
createdDocuments = [createdDocumentsAccumulator copy];
1202+
}
1203+
1204+
(void)createdDocuments;
1205+
}
1206+
11831207
@end

0 commit comments

Comments
 (0)