Skip to content

Commit 38faa63

Browse files
committed
fix MockConnection error
1 parent b72c54d commit 38faa63

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

packages/firestore/src/api/aggregate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export {
3434
* server. Returns an error if the network is not available.
3535
*
3636
* @param query - The `Query` to execute.
37-
*
37+
*
3838
* @returns A `Promise` that will be resolved with the results of the query.
3939
*/
4040
export function getCountFromServer(

packages/firestore/src/remote/datastore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,11 @@ export async function invokeRunAggregationQueryRpc(
250250
if (!datastoreImpl.connection.shouldResourcePathBeIncludedInRequest) {
251251
delete request.parent;
252252
}
253+
const EXPECTED_RESPONSE_COUNT = 1;
253254
const response = await datastoreImpl.invokeStreamingRPC<
254255
ProtoRunAggregationQueryRequest,
255256
ProtoRunAggregationQueryResponse
256-
>('RunAggregationQuery', parent!, request);
257+
>('RunAggregationQuery', parent!, request, EXPECTED_RESPONSE_COUNT);
257258
return (
258259
response
259260
// Omit RunAggregationQueryResponse that only contain readTimes.

packages/firestore/test/unit/remote/datastore.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ describe('Datastore', () => {
6565
): Stream<Req, Resp> {
6666
throw new Error('MockConnection.openStream() must be replaced');
6767
}
68+
69+
shouldResourcePathBeIncludedInRequest: boolean = false;
6870
}
6971

7072
class MockAuthCredentialsProvider extends EmptyAuthCredentialsProvider {

packages/firestore/test/unit/specs/spec_test_components.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ export class MockConnection implements Connection {
253253

254254
constructor(private queue: AsyncQueue) {}
255255

256+
shouldResourcePathBeIncludedInRequest: boolean = false;
257+
256258
/**
257259
* Tracks the currently active watch targets as detected by the mock watch
258260
* stream, as a mapping from target ID to query Target.

0 commit comments

Comments
 (0)