@@ -888,6 +888,31 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
888
888
} ) ;
889
889
} ) ;
890
890
891
+ it ( 'performs sum that is positive infinity using getAggregationFromServer v2' , ( ) => {
892
+ const testDocs = {
893
+ a : {
894
+ author : 'authorA' ,
895
+ title : 'titleA' ,
896
+ pages : 100 ,
897
+ year : 1980 ,
898
+ rating : Number . MAX_VALUE
899
+ } ,
900
+ b : {
901
+ author : 'authorB' ,
902
+ title : 'titleB' ,
903
+ pages : 50 ,
904
+ year : 2020 ,
905
+ rating : 1e293
906
+ }
907
+ } ;
908
+ return withTestCollection ( persistence , testDocs , async coll => {
909
+ const snapshot = await getAggregateFromServer ( coll , {
910
+ totalRating : sum ( 'rating' )
911
+ } ) ;
912
+ expect ( snapshot . data ( ) . totalRating ) . to . equal ( Number . POSITIVE_INFINITY ) ;
913
+ } ) ;
914
+ } ) ;
915
+
891
916
it ( 'performs sum that is negative infinity using getAggregationFromServer' , ( ) => {
892
917
const testDocs = {
893
918
a : {
@@ -1248,7 +1273,7 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
1248
1273
title : 'titleA' ,
1249
1274
pages : 100 ,
1250
1275
year : 1980 ,
1251
- rating : 10.5
1276
+ rating : 8.6
1252
1277
} ,
1253
1278
b : {
1254
1279
author : 'authorB' ,
@@ -1269,7 +1294,7 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
1269
1294
const snapshot = await getAggregateFromServer ( coll , {
1270
1295
averageRating : average ( 'rating' )
1271
1296
} ) ;
1272
- expect ( snapshot . data ( ) . averageRating ) . to . equal ( 10 ) ;
1297
+ expect ( snapshot . data ( ) . averageRating ) . to . equal ( 9.2 ) ;
1273
1298
} ) ;
1274
1299
} ) ;
1275
1300
@@ -1288,13 +1313,6 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
1288
1313
pages : 50 ,
1289
1314
year : 2020 ,
1290
1315
rating : 9
1291
- } ,
1292
- c : {
1293
- author : 'authorC' ,
1294
- title : 'titleC' ,
1295
- pages : 150 ,
1296
- year : 2021 ,
1297
- rating : 10
1298
1316
}
1299
1317
} ;
1300
1318
return withTestCollection ( persistence , testDocs , async coll => {
0 commit comments