Skip to content

Commit 190d706

Browse files
committed
add test
1 parent 5006c2a commit 190d706

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
@@ -896,6 +896,30 @@ - (void)testSdkOrdersQueryByDocumentIdTheSameWayOnlineAndOffline {
896896
]];
897897
}
898898

899+
- (void)testSnapshotListenerSortsNumbersSameWayAsServer {
900+
FIRCollectionReference *collRef = [self collectionRefWithDocuments:@{
901+
@"intMin" : @{@"value" : @LLONG_MIN},
902+
@"doubleMin" : @{@"value" : @((double)LLONG_MIN - 100)},
903+
@"intMax" : @{@"value" : @LLONG_MAX},
904+
@"doubleMax" : @{@"value" : @((double)LLONG_MAX + 100)},
905+
@"NaN" : @{@"value" :[NSNumber numberWithFloat:NAN]},
906+
@"integerMax" : @{@"value" : @(INT_MAX)},
907+
@"integerMin" : @{@"value" : @(INT_MAX)},
908+
@"negativeInfinity" : @{@"value" : @(-INFINITY)},
909+
@"positiveInfinity" : @{@"value" : @(INFINITY)}
910+
}];
911+
912+
FIRQuery *query = [collRef queryOrderedByField:@"value"];
913+
FIRQuerySnapshot *getSnapshot = [self readDocumentSetForRef:query];
914+
915+
id<FIRListenerRegistration> registration =
916+
[query addSnapshotListener:self.eventAccumulator.valueEventHandler];
917+
FIRQuerySnapshot *watchSnapshot = [self.eventAccumulator awaitEventWithName:@"Snapshot"];
918+
XCTAssertEqualObjects(FIRQuerySnapshotGetIDs(watchSnapshot), FIRQuerySnapshotGetIDs(getSnapshot));
919+
920+
[registration remove];
921+
}
922+
899923
- (void)testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIDs {
900924
// Use .document() to get a random collection group name to use but ensure it starts with 'b'
901925
// for predictable ordering.

0 commit comments

Comments
 (0)