test(query.test.ts): added test cases for query endpoint#92
Conversation
Greptile SummaryAdds integration test coverage for the Data Query gRPC endpoint. Confidence Score: 3/5The PR is test-only, but several new assertions are brittle or miss the ordering behavior they are intended to cover. The changed tests improve endpoint coverage but can fail against dirty data, rely on unspecified row ordering, and do not exercise the non-empty ordering contract. src/tests/query.test.ts
What T-Rex did
Reviews (1): Last reviewed commit: "test(query.test.ts): added test cases fo..." | Re-trigger Greptile |
|
|
||
| expect(response.columns).toContain("key"); | ||
| expect(response.columns).toContain("amount"); | ||
| expect(response.total).toBe(1); |
There was a problem hiding this comment.
Clear test state first This test asserts the global query total is exactly
1, but the suite only calls clearDatabase() in afterAll. If a previous run failed before cleanup, or this test is run against a dirty test database, an existing matching tags row makes this assertion fail even though the query endpoint is behaving correctly. Clear the database before the suite or use a unique key and assert only on the inserted row.
| { | ||
| table: "tags", | ||
| where: FilterGroup.create({ logical: 1, conditions: [], groups: [] }), | ||
| orderBy: [], |
There was a problem hiding this comment.
Order pagination deterministically This pagination test uses
offset while leaving orderBy empty. Postgres does not guarantee row order without ORDER BY, so the three pages can overlap, skip rows, or change order as table contents and query plans change. Add a stable ordering and assert the page contents so this test verifies pagination instead of only checking row counts.
| ], | ||
| groups: [], | ||
| }), | ||
| orderBy: [], |
There was a problem hiding this comment.
Exercise ordering contract Every request in this new coverage sends
orderBy, but the server-side schema currently reads orderByList before transforming it to orderBy. Because these tests only send an empty list, they pass even if client-supplied ordering is ignored by the endpoint. Add a non-empty ordering case using the actual generated request field so the test catches this API/schema mismatch.
No description provided.