@@ -22,7 +22,7 @@ import chaiAsPromised from 'chai-as-promised';
22
22
23
23
import {
24
24
countQuery ,
25
- getAggregateFromServerDirect ,
25
+ getAggregate ,
26
26
aggregateQueryEqual ,
27
27
aggregateQuerySnapshotEqual
28
28
} from '../../src/lite-api/aggregate' ;
@@ -2050,7 +2050,7 @@ describe('countQuery()', () => {
2050
2050
return withTestCollection ( async coll => {
2051
2051
const query_ = query ( coll ) ;
2052
2052
const countQuery_ = countQuery ( query_ ) ;
2053
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2053
+ const snapshot = await getAggregate ( countQuery_ ) ;
2054
2054
expect ( countQuery_ . query ) . to . equal ( query_ ) ;
2055
2055
expect ( snapshot . query ) . to . equal ( countQuery_ ) ;
2056
2056
expect ( snapshot . query . query ) . to . equal ( query_ ) ;
@@ -2060,7 +2060,7 @@ describe('countQuery()', () => {
2060
2060
it ( 'empty test collection count' , ( ) => {
2061
2061
return withTestCollection ( async coll => {
2062
2062
const countQuery_ = countQuery ( query ( coll ) ) ;
2063
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2063
+ const snapshot = await getAggregate ( countQuery_ ) ;
2064
2064
expect ( snapshot . getCount ( ) ) . to . equal ( 0 ) ;
2065
2065
} ) ;
2066
2066
} ) ;
@@ -2073,7 +2073,7 @@ describe('countQuery()', () => {
2073
2073
] ;
2074
2074
return withTestCollectionAndInitialData ( testDocs , async collection => {
2075
2075
const countQuery_ = countQuery ( query ( collection ) ) ;
2076
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2076
+ const snapshot = await getAggregate ( countQuery_ ) ;
2077
2077
expect ( snapshot . getCount ( ) ) . to . equal ( 3 ) ;
2078
2078
} ) ;
2079
2079
} ) ;
@@ -2087,7 +2087,7 @@ describe('countQuery()', () => {
2087
2087
return withTestCollectionAndInitialData ( testDocs , async collection => {
2088
2088
const query_ = query ( collection , where ( 'author' , '==' , 'authorA' ) ) ;
2089
2089
const countQuery_ = countQuery ( query_ ) ;
2090
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2090
+ const snapshot = await getAggregate ( countQuery_ ) ;
2091
2091
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2092
2092
} ) ;
2093
2093
} ) ;
@@ -2105,7 +2105,7 @@ describe('countQuery()', () => {
2105
2105
limit ( 1 )
2106
2106
) ;
2107
2107
const countQuery_ = countQuery ( query_ ) ;
2108
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2108
+ const snapshot = await getAggregate ( countQuery_ ) ;
2109
2109
expect ( snapshot . getCount ( ) ) . to . equal ( 1 ) ;
2110
2110
} ) ;
2111
2111
} ) ;
@@ -2123,7 +2123,7 @@ describe('countQuery()', () => {
2123
2123
limit ( 3 )
2124
2124
) ;
2125
2125
const countQuery_ = countQuery ( query_ ) ;
2126
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2126
+ const snapshot = await getAggregate ( countQuery_ ) ;
2127
2127
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2128
2128
} ) ;
2129
2129
} ) ;
@@ -2138,7 +2138,7 @@ describe('countQuery()', () => {
2138
2138
return withTestCollectionAndInitialData ( testDocs , async collection => {
2139
2139
const query_ = query ( collection , orderBy ( 'title' ) ) ;
2140
2140
const countQuery_ = countQuery ( query_ ) ;
2141
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2141
+ const snapshot = await getAggregate ( countQuery_ ) ;
2142
2142
expect ( snapshot . getCount ( ) ) . to . equal ( 3 ) ;
2143
2143
} ) ;
2144
2144
} ) ;
@@ -2153,7 +2153,7 @@ describe('countQuery()', () => {
2153
2153
return withTestCollectionAndInitialData ( testDocs , async collection => {
2154
2154
const query_ = query ( collection , orderBy ( 'id' ) , startAt ( 2 ) ) ;
2155
2155
const countQuery_ = countQuery ( query_ ) ;
2156
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2156
+ const snapshot = await getAggregate ( countQuery_ ) ;
2157
2157
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2158
2158
} ) ;
2159
2159
} ) ;
@@ -2168,7 +2168,7 @@ describe('countQuery()', () => {
2168
2168
return withTestCollectionAndInitialData ( testDocs , async collection => {
2169
2169
const query_ = query ( collection , orderBy ( 'id' ) , startAfter ( 2 ) ) ;
2170
2170
const countQuery_ = countQuery ( query_ ) ;
2171
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2171
+ const snapshot = await getAggregate ( countQuery_ ) ;
2172
2172
expect ( snapshot . getCount ( ) ) . to . equal ( 1 ) ;
2173
2173
} ) ;
2174
2174
} ) ;
@@ -2183,7 +2183,7 @@ describe('countQuery()', () => {
2183
2183
return withTestCollectionAndInitialData ( testDocs , async collection => {
2184
2184
const query_ = query ( collection , orderBy ( 'id' ) , startAt ( 1 ) , endAt ( 2 ) ) ;
2185
2185
const countQuery_ = countQuery ( query_ ) ;
2186
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2186
+ const snapshot = await getAggregate ( countQuery_ ) ;
2187
2187
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2188
2188
} ) ;
2189
2189
} ) ;
@@ -2198,7 +2198,7 @@ describe('countQuery()', () => {
2198
2198
return withTestCollectionAndInitialData ( testDocs , async collection => {
2199
2199
const query_ = query ( collection , orderBy ( 'id' ) , startAt ( 1 ) , endBefore ( 2 ) ) ;
2200
2200
const countQuery_ = countQuery ( query_ ) ;
2201
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2201
+ const snapshot = await getAggregate ( countQuery_ ) ;
2202
2202
expect ( snapshot . getCount ( ) ) . to . equal ( 1 ) ;
2203
2203
} ) ;
2204
2204
} ) ;
@@ -2215,7 +2215,7 @@ describe('countQuery()', () => {
2215
2215
where ( 'author' , '==' , 'authorA' )
2216
2216
) . withConverter ( postConverter ) ;
2217
2217
const countQuery_ = countQuery ( query_ ) ;
2218
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2218
+ const snapshot = await getAggregate ( countQuery_ ) ;
2219
2219
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2220
2220
} ) ;
2221
2221
} ) ;
@@ -2236,7 +2236,7 @@ describe('countQuery()', () => {
2236
2236
}
2237
2237
await batch . commit ( ) ;
2238
2238
const countQuery_ = countQuery ( collectionGroup ( db , collectionGroupId ) ) ;
2239
- const snapshot = await getAggregateFromServerDirect ( countQuery_ ) ;
2239
+ const snapshot = await getAggregate ( countQuery_ ) ;
2240
2240
expect ( snapshot . getCount ( ) ) . to . equal ( 2 ) ;
2241
2241
} ) ;
2242
2242
} ) ;
@@ -2283,9 +2283,9 @@ describe('countQuery()', () => {
2283
2283
const countQuery1A = countQuery ( query1 ) ;
2284
2284
const countQuery1B = countQuery ( query1 ) ;
2285
2285
const countQuery2 = countQuery ( query2 ) ;
2286
- const snapshot1A = await getAggregateFromServerDirect ( countQuery1A ) ;
2287
- const snapshot1B = await getAggregateFromServerDirect ( countQuery1B ) ;
2288
- const snapshot2 = await getAggregateFromServerDirect ( countQuery2 ) ;
2286
+ const snapshot1A = await getAggregate ( countQuery1A ) ;
2287
+ const snapshot1B = await getAggregate ( countQuery1B ) ;
2288
+ const snapshot2 = await getAggregate ( countQuery2 ) ;
2289
2289
expect ( aggregateQuerySnapshotEqual ( snapshot1A , snapshot1B ) ) . to . be . true ;
2290
2290
expect ( aggregateQuerySnapshotEqual ( snapshot1A , snapshot2 ) ) . to . be . true ;
2291
2291
} ) ;
@@ -2302,8 +2302,8 @@ describe('countQuery()', () => {
2302
2302
const query2 = query ( collection , where ( 'author' , '==' , 'authorB' ) ) ;
2303
2303
const countQuery1 = countQuery ( query1 ) ;
2304
2304
const countQuery2 = countQuery ( query2 ) ;
2305
- const snapshot1 = await getAggregateFromServerDirect ( countQuery1 ) ;
2306
- const snapshot2 = await getAggregateFromServerDirect ( countQuery2 ) ;
2305
+ const snapshot1 = await getAggregate ( countQuery1 ) ;
2306
+ const snapshot2 = await getAggregate ( countQuery2 ) ;
2307
2307
expect ( aggregateQuerySnapshotEqual ( snapshot1 , snapshot2 ) ) . to . be . false ;
2308
2308
} ) ;
2309
2309
} ) ;
@@ -2312,7 +2312,7 @@ describe('countQuery()', () => {
2312
2312
return withTestCollection ( async collection => {
2313
2313
await terminate ( collection . firestore ) ;
2314
2314
const countQuery_ = countQuery ( query ( collection ) ) ;
2315
- expect ( ( ) => getAggregateFromServerDirect ( countQuery_ ) ) . to . throw (
2315
+ expect ( ( ) => getAggregate ( countQuery_ ) ) . to . throw (
2316
2316
'The client has already been terminated.'
2317
2317
) ;
2318
2318
} ) ;
@@ -2326,7 +2326,7 @@ describe('countQuery()', () => {
2326
2326
] ;
2327
2327
return withTestCollectionAndInitialData ( testDocs , async collection => {
2328
2328
const countQuery_ = countQuery ( query ( collection ) ) ;
2329
- const promise = getAggregateFromServerDirect ( countQuery_ ) ;
2329
+ const promise = getAggregate ( countQuery_ ) ;
2330
2330
await terminate ( collection . firestore ) ;
2331
2331
const snapshot = await promise ;
2332
2332
expect ( snapshot . getCount ( ) ) . to . equal ( 3 ) ;
0 commit comments