|
23 | 23 | #import "Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
|
24 | 24 | #import "Firestore/Example/Tests/Util/FSTTestingHooks.h"
|
25 | 25 |
|
26 |
| -namespace { |
27 |
| - |
28 |
| -NSArray<NSString *> *SortedStringsNotIn(NSSet<NSString *> *set, NSSet<NSString *> *remove) { |
29 |
| - NSMutableSet<NSString *> *mutableSet = [NSMutableSet setWithSet:set]; |
30 |
| - [mutableSet minusSet:remove]; |
31 |
| - return [mutableSet.allObjects sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; |
32 |
| -} |
33 |
| - |
34 |
| -} // namespace |
35 |
| - |
36 | 26 | @interface FIRQueryTests : FSTIntegrationTestCase
|
37 | 27 | @end
|
38 | 28 |
|
@@ -1247,30 +1237,16 @@ - (void)testResumingAQueryShouldUseBloomFilterToAvoidFullRequery {
|
1247 | 1237 |
|
1248 | 1238 | // Verify that the snapshot from the resumed query contains the expected documents; that is,
|
1249 | 1239 | // that it contains the 50 documents that were _not_ deleted.
|
1250 |
| - NSSet<NSString *> *actualDocumentIds = |
1251 |
| - [NSSet setWithArray:FIRQuerySnapshotGetIDs(querySnapshot2)]; |
1252 |
| - NSSet<NSString *> *expectedDocumentIds; |
1253 | 1240 | {
|
1254 |
| - NSMutableArray<NSString *> *expectedDocumentIdsAccumulator = [[NSMutableArray alloc] init]; |
| 1241 | + NSMutableArray<NSString *> *expectedDocumentIds = [[NSMutableArray alloc] init]; |
1255 | 1242 | for (FIRDocumentReference *documentRef in createdDocuments) {
|
1256 | 1243 | if (![deletedDocumentIds containsObject:documentRef.documentID]) {
|
1257 |
| - [expectedDocumentIdsAccumulator addObject:documentRef.documentID]; |
| 1244 | + [expectedDocumentIds addObject:documentRef.documentID]; |
1258 | 1245 | }
|
1259 | 1246 | }
|
1260 |
| - expectedDocumentIds = [NSSet setWithArray:expectedDocumentIdsAccumulator]; |
1261 |
| - } |
1262 |
| - if (![actualDocumentIds isEqualToSet:expectedDocumentIds]) { |
1263 |
| - NSArray<NSString *> *unexpectedDocumentIds = |
1264 |
| - SortedStringsNotIn(actualDocumentIds, expectedDocumentIds); |
1265 |
| - NSArray<NSString *> *missingDocumentIds = |
1266 |
| - SortedStringsNotIn(expectedDocumentIds, actualDocumentIds); |
1267 |
| - XCTFail(@"querySnapshot2 contained %lu documents (expected %lu): " |
1268 |
| - @"%lu unexpected and %lu missing; " |
1269 |
| - @"unexpected documents: %@; missing documents: %@", |
1270 |
| - (unsigned long)actualDocumentIds.count, (unsigned long)expectedDocumentIds.count, |
1271 |
| - (unsigned long)unexpectedDocumentIds.count, (unsigned long)missingDocumentIds.count, |
1272 |
| - [unexpectedDocumentIds componentsJoinedByString:@", "], |
1273 |
| - [missingDocumentIds componentsJoinedByString:@", "]); |
| 1247 | + XCTAssertEqualObjects([NSSet setWithArray:FIRQuerySnapshotGetIDs(querySnapshot2)], |
| 1248 | + [NSSet setWithArray:expectedDocumentIds], |
| 1249 | + @"querySnapshot2 has the wrong documents"); |
1274 | 1250 | }
|
1275 | 1251 |
|
1276 | 1252 | // Verify that Watch sent an existence filter with the correct counts when the query was
|
|
0 commit comments