-
Notifications
You must be signed in to change notification settings - Fork 1
fix: replace expect(true).toBe(true) placeholder assertions with meaningful checks #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -298,12 +298,11 @@ describe('GraphQL Protocol Integration Tests', () => { | |||||||
| describe('Error Handling', () => { | ||||||||
| it('should handle invalid object name', async () => { | ||||||||
| try { | ||||||||
| await kernel.repository.find('nonexistent', {}); | ||||||||
| // If no error is thrown, the test should still pass | ||||||||
| // as some drivers may return empty results | ||||||||
| expect(true).toBe(true); | ||||||||
| const result = await kernel.repository.find('nonexistent', {}); | ||||||||
| // Driver returns an empty array for unknown collections | ||||||||
| expect(Array.isArray(result)).toBe(true); | ||||||||
|
||||||||
| expect(Array.isArray(result)).toBe(true); | |
| expect(Array.isArray(result)).toBe(true); | |
| expect(result).toHaveLength(0); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -290,8 +290,9 @@ describe('JSON-RPC 2.0 Protocol Integration Tests', () => { | |||||
| it('should handle method not found (-32601)', async () => { | ||||||
| try { | ||||||
| // Simulate calling non-existent method | ||||||
| await kernel.repository.find('nonexistent', {}); | ||||||
| expect(true).toBe(true); // Driver may return empty | ||||||
| const result = await kernel.repository.find('nonexistent', {}); | ||||||
| // Driver returns empty array for unknown collections | ||||||
| expect(Array.isArray(result)).toBe(true); | ||||||
| } catch (error) { | ||||||
| expect(error).toBeDefined(); | ||||||
| } | ||||||
|
|
@@ -311,11 +312,11 @@ describe('JSON-RPC 2.0 Protocol Integration Tests', () => { | |||||
|
|
||||||
| it('should handle application errors', async () => { | ||||||
| try { | ||||||
| await kernel.repository.update('tasks', 'non-existent', { | ||||||
| const result = await kernel.repository.update('tasks', 'non-existent', { | ||||||
| title: 'Updated' | ||||||
| }); | ||||||
| // May return null or throw | ||||||
| expect(true).toBe(true); | ||||||
| // MemoryDriver returns null for non-existent records in non-strict mode | ||||||
| expect(result).toBeNull(); | ||||||
| } catch (error) { | ||||||
| expect(error).toBeDefined(); | ||||||
| } | ||||||
|
|
@@ -559,17 +560,19 @@ describe('JSON-RPC 2.0 Protocol Integration Tests', () => { | |||||
| describe('Error Handling and Recovery', () => { | ||||||
| it('should handle null parameters gracefully', async () => { | ||||||
| try { | ||||||
| await kernel.repository.find('tasks', null as any); | ||||||
| expect(true).toBe(true); | ||||||
| const result = await kernel.repository.find('tasks', null as any); | ||||||
| // Driver handles null query gracefully — returns records or empty array | ||||||
| expect(result).toBeDefined(); | ||||||
|
Comment on lines
+563
to
+565
|
||||||
| } catch (error) { | ||||||
| expect(error).toBeDefined(); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| it('should handle empty object name', async () => { | ||||||
| try { | ||||||
| await kernel.repository.find('', {}); | ||||||
| expect(true).toBe(true); | ||||||
| const result = await kernel.repository.find('', {}); | ||||||
| // Driver returns empty array for unknown/empty collection names | ||||||
| expect(Array.isArray(result)).toBe(true); | ||||||
|
||||||
| expect(Array.isArray(result)).toBe(true); | |
| expect(result).toHaveLength(0); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -385,9 +385,9 @@ describe('OData V4 Protocol Integration Tests', () => { | |||||
| describe('Error Response Format', () => { | ||||||
| it('should handle invalid entity set', async () => { | ||||||
| try { | ||||||
| await kernel.repository.find('NonExistent', {}); | ||||||
| // If no error, that's fine - driver returns empty | ||||||
| expect(true).toBe(true); | ||||||
| const result = await kernel.repository.find('NonExistent', {}); | ||||||
| // Driver returns an empty array for unknown collections | ||||||
| expect(Array.isArray(result)).toBe(true); | ||||||
|
||||||
| expect(Array.isArray(result)).toBe(true); | |
| expect(result).toHaveLength(0); |
Copilot
AI
Mar 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment/expectation suggests the driver handles a null query “gracefully”, but MemoryDriver.find currently treats query as an object and will throw a TypeError when null is passed. Either update the test to explicitly assert that an error is thrown for null queries, or change the comment and input to an actually supported “malformed” shape (so the try-branch assertion is meaningful).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new assertion doesn’t actually verify that
registerSchemastored anything:optimizer.optimize({ object: 'accounts' })returns SQL containingaccountseven when no schema is registered (it falls back toSELECT * FROM accounts). Consider asserting on behavior that only occurs when a schema is registered (e.g., aUSE INDEX (...)hint when filters match an index).