Skip to content

Commit 7a59c55

Browse files
authored
Firestore: FIRQueryTests.mm: Replace SortedStringsNotIn() custom function (#11649)
1 parent 8101179 commit 7a59c55

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

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

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323
#import "Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
2424
#import "Firestore/Example/Tests/Util/FSTTestingHooks.h"
2525

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-
3626
@interface FIRQueryTests : FSTIntegrationTestCase
3727
@end
3828

@@ -1247,30 +1237,16 @@ - (void)testResumingAQueryShouldUseBloomFilterToAvoidFullRequery {
12471237

12481238
// Verify that the snapshot from the resumed query contains the expected documents; that is,
12491239
// that it contains the 50 documents that were _not_ deleted.
1250-
NSSet<NSString *> *actualDocumentIds =
1251-
[NSSet setWithArray:FIRQuerySnapshotGetIDs(querySnapshot2)];
1252-
NSSet<NSString *> *expectedDocumentIds;
12531240
{
1254-
NSMutableArray<NSString *> *expectedDocumentIdsAccumulator = [[NSMutableArray alloc] init];
1241+
NSMutableArray<NSString *> *expectedDocumentIds = [[NSMutableArray alloc] init];
12551242
for (FIRDocumentReference *documentRef in createdDocuments) {
12561243
if (![deletedDocumentIds containsObject:documentRef.documentID]) {
1257-
[expectedDocumentIdsAccumulator addObject:documentRef.documentID];
1244+
[expectedDocumentIds addObject:documentRef.documentID];
12581245
}
12591246
}
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");
12741250
}
12751251

12761252
// Verify that Watch sent an existence filter with the correct counts when the query was

0 commit comments

Comments
 (0)