Skip to content

Commit 05385c3

Browse files
committed
More test updates.
1 parent efdbcce commit 05385c3

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

packages/firestore/test/integration/api/aggregation.test.ts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,31 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
888888
});
889889
});
890890

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+
891916
it('performs sum that is negative infinity using getAggregationFromServer', () => {
892917
const testDocs = {
893918
a: {
@@ -1248,7 +1273,7 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
12481273
title: 'titleA',
12491274
pages: 100,
12501275
year: 1980,
1251-
rating: 10.5
1276+
rating: 8.6
12521277
},
12531278
b: {
12541279
author: 'authorB',
@@ -1269,7 +1294,7 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
12691294
const snapshot = await getAggregateFromServer(coll, {
12701295
averageRating: average('rating')
12711296
});
1272-
expect(snapshot.data().averageRating).to.equal(10);
1297+
expect(snapshot.data().averageRating).to.equal(9.2);
12731298
});
12741299
});
12751300

@@ -1288,13 +1313,6 @@ apiDescribe('Aggregation queries - sum / average', (persistence: boolean) => {
12881313
pages: 50,
12891314
year: 2020,
12901315
rating: 9
1291-
},
1292-
c: {
1293-
author: 'authorC',
1294-
title: 'titleC',
1295-
pages: 150,
1296-
year: 2021,
1297-
rating: 10
12981316
}
12991317
};
13001318
return withTestCollection(persistence, testDocs, async coll => {

0 commit comments

Comments
 (0)