@@ -896,6 +896,48 @@ - (void)testSdkOrdersQueryByDocumentIdTheSameWayOnlineAndOffline {
896896 ]];
897897}
898898
899+ - (void )testSnapshotListenerSortsUnicodeStringsInTheSameOrderAsServer {
900+ FIRCollectionReference *collRef = [self collectionRefWithDocuments: @{
901+ @" a" : @{@" value" : @ " Łukasiewicz" },
902+ @" b" : @{@" value" : @" Sierpiński" },
903+ @" c" : @{@" value" : @" 岩澤" },
904+ @" d" : @{@" value" : @" 🄟" },
905+ @" e" : @{@" value" : @" P" },
906+ @" f" : @{@" value" : @" ︒" },
907+ @" g" : @{@" value" : @" 🐵" }
908+
909+ }];
910+
911+ FIRQuery *query = [collRef queryOrderedByField: @" value" ];
912+ NSArray <NSString *> *expectedDocs =
913+ @[ @" b" , @" a" , @" c" , @" f" , @" e" , @" d" , @" g" ];
914+ FIRQuerySnapshot *getSnapshot = [self readDocumentSetForRef: query];
915+ XCTAssertEqualObjects (FIRQuerySnapshotGetIDs (getSnapshot), expectedDocs);
916+
917+ id <FIRListenerRegistration> registration =
918+ [query addSnapshotListener: self .eventAccumulator.valueEventHandler];
919+ FIRQuerySnapshot *watchSnapshot = [self .eventAccumulator awaitEventWithName: @" Snapshot" ];
920+ XCTAssertEqualObjects (FIRQuerySnapshotGetIDs (watchSnapshot), expectedDocs);
921+
922+ [registration remove ];
923+ }
924+
925+ - (void )testSnapshotListenerSortsUnicodeStringsTheSameWayOnlineAndOffline {
926+ FIRCollectionReference *collRef = [self collectionRefWithDocuments: @{
927+ @" a" : @{@" value" : @ " Łukasiewicz" },
928+ @" b" : @{@" value" : @" Sierpiński" },
929+ @" c" : @{@" value" : @" 岩澤" },
930+ @" d" : @{@" value" : @" 🄟" },
931+ @" e" : @{@" value" : @" P" },
932+ @" f" : @{@" value" : @" ︒" },
933+ @" g" : @{@" value" : @" 🐵" }
934+
935+ }];
936+
937+ [self checkOnlineAndOfflineQuery: [collRef queryOrderedByField: @" value" ]
938+ matchesResult: @[@" b" , @" a" , @" c" , @" f" , @" e" , @" d" , @" g" ]];
939+ }
940+
899941- (void )testCollectionGroupQueriesWithWhereFiltersOnArbitraryDocumentIDs {
900942 // Use .document() to get a random collection group name to use but ensure it starts with 'b'
901943 // for predictable ordering.
0 commit comments