Skip to content

Commit d8aecde

Browse files
committed
test(firestore): add regression test for limit(0) serialization
For #7382
1 parent e7f1b6f commit d8aecde

3 files changed

Lines changed: 2 additions & 5 deletions

File tree

handwritten/firestore/dev/src/reference/query-util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export class QueryUtil<
344344
// call to `requestStream()` will backoff should the restart
345345
// fail before delivering any results.
346346
let newQuery: Query<AppModelType, DbModelType>;
347-
if (!this._queryOptions.limit) {
347+
if (this._queryOptions.limit === undefined) {
348348
newQuery = query;
349349
} else {
350350
const newLimit =

handwritten/firestore/dev/src/reference/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ export class Query<
16081608
structuredQuery.startAt = this.toCursor(this._queryOptions.startAt);
16091609
structuredQuery.endAt = this.toCursor(this._queryOptions.endAt);
16101610

1611-
if (this._queryOptions.limit) {
1611+
if (this._queryOptions.limit !== undefined) {
16121612
structuredQuery.limit = {value: this._queryOptions.limit};
16131613
}
16141614

handwritten/firestore/dev/test/query.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,9 +1958,6 @@ describe('limit() interface', () => {
19581958
await query.get();
19591959
});
19601960

1961-
// Regression test: This test currently fails because limit(0) is not
1962-
// serialized in the query proto (limit(0) is falsy in JavaScript).
1963-
// This test is expected to fail until the fix is applied.
19641961
it('handles limit(0) correctly', async () => {
19651962
const overrides: ApiOverride = {
19661963
runQuery: request => {

0 commit comments

Comments
 (0)