GeezerVison is showing github.com — test(firestore): add regression test for limit(0) serialization · googleapis/google-cloud-node@d8aecde
File tree
Expand file treeCollapse file tree
Open diff view settings
handwritten/firestore/dev
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: handwritten/firestore/dev/src/reference/query-util.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -344,7 +344,7 @@ export class QueryUtil< |
344 | 344 | // call to `requestStream()` will backoff should the restart |
345 | 345 | // fail before delivering any results. |
346 | 346 | let newQuery: Query<AppModelType, DbModelType>; |
347 | | - if (!this._queryOptions.limit) { |
| 347 | + if (this._queryOptions.limit === undefined) { |
348 | 348 | newQuery = query; |
349 | 349 | } else { |
350 | 350 | const newLimit = |
|
Collapse file
Copy file name to clipboardExpand all lines: handwritten/firestore/dev/src/reference/query.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1608,7 +1608,7 @@ export class Query< |
1608 | 1608 | structuredQuery.startAt = this.toCursor(this._queryOptions.startAt); |
1609 | 1609 | structuredQuery.endAt = this.toCursor(this._queryOptions.endAt); |
1610 | 1610 |
|
1611 | | - if (this._queryOptions.limit) { |
| 1611 | + if (this._queryOptions.limit !== undefined) { |
1612 | 1612 | structuredQuery.limit = {value: this._queryOptions.limit}; |
1613 | 1613 | } |
1614 | 1614 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: handwritten/firestore/dev/test/query.ts -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1958,9 +1958,6 @@ describe('limit() interface', () => { |
1958 | 1958 | await query.get(); |
1959 | 1959 | }); |
1960 | 1960 |
|
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. |
1964 | 1961 | it('handles limit(0) correctly', async () => { |
1965 | 1962 | const overrides: ApiOverride = { |
1966 | 1963 | runQuery: request => { |
|