@@ -54,7 +54,8 @@ import {
5454 writeBatch ,
5555 CollectionReference ,
5656 WriteBatch ,
57- Firestore
57+ Firestore ,
58+ getDocsFromServer
5859} from '../util/firebase_export' ;
5960import {
6061 apiDescribe ,
@@ -66,7 +67,8 @@ import {
6667 withRetry ,
6768 withTestCollection ,
6869 withTestDb ,
69- checkOnlineAndOfflineResultsMatch
70+ checkOnlineAndOfflineResultsMatch ,
71+ toIds
7072} from '../util/helpers' ;
7173import { USE_EMULATOR } from '../util/settings' ;
7274import { captureExistenceFilterMismatches } from '../util/testing_hooks_util' ;
@@ -2218,6 +2220,32 @@ apiDescribe('Queries', persistence => {
22182220 }
22192221 ) . timeout ( '90s' ) ;
22202222
2223+ it . only ( 'snapshot listener sorts cross type numbers same way as server' , async ( ) => {
2224+ const testDocs = {
2225+ 'a' : { value : 'Łukasiewicz' } ,
2226+ 'b' : { value : 'Sierpiński' } ,
2227+ 'c' : { value : '岩澤' } ,
2228+ 'd' : { value : '🄟' } ,
2229+ 'e' : { value : 'P' } ,
2230+ 'f' : { value : '︒' } ,
2231+ 'g' : { value : '🐵' } ,
2232+ } ;
2233+
2234+ return withTestCollection ( persistence , testDocs , async collectionRef => {
2235+ const orderedQuery = query ( collectionRef , orderBy ( 'value' ) ) ;
2236+
2237+ const getSnapshot = await getDocsFromServer ( orderedQuery ) ;
2238+ expect ( toIds ( getSnapshot ) ) . to . deep . equal ( [ "b" , "a" , "c" , "f" , "e" , "d" , "g" ] ) ;
2239+
2240+ const storeEvent = new EventsAccumulator < QuerySnapshot > ( ) ;
2241+ const unsubscribe = onSnapshot ( orderedQuery , storeEvent . storeEvent ) ;
2242+ const watchSnapshot = await storeEvent . awaitEvent ( ) ;
2243+ expect ( toIds ( watchSnapshot ) ) . to . deep . equal ( toIds ( getSnapshot ) ) ;
2244+
2245+ unsubscribe ( ) ;
2246+ } ) ;
2247+ } ) ;
2248+
22212249 it ( 'can query large documents with multi-byte character strings' , ( ) => {
22222250 function randomMultiByteCharString ( length : number ) : string {
22232251 const charCodes : number [ ] = [ ] ;
0 commit comments