Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ ObjectQL is the **Standard Protocol for AI Software Generation** — a universal
- ✅ 67 documentation files (.mdx) across 12 sections
- ✅ `@objectql/driver-turso` — Turso/libSQL driver (Phase A: Core Driver) with 125 tests, 3 connection modes (remote, local, embedded replica)
- ✅ `@objectql/driver-turso` — Phase B: Multi-Tenant Router, Schema Diff Engine, Platform API Client, Driver Plugin (52 new tests, 177 total)
- ✅ Fix test quality: replaced all `expect(true).toBe(true)` placeholder assertions with meaningful state checks across `plugin-optimizations`, `protocol-odata-v4`, `protocol-json-rpc`, and `protocol-graphql` (7 files, 10 assertions fixed)

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,9 @@ describe('SQLQueryOptimizer', () => {
fields: { name: { type: 'text' } },
indexes: [{ name: 'idx_name', fields: ['name'], unique: false }],
});
// No error is the assertion
expect(true).toBe(true);
// Verify the schema was registered by observing optimize behavior
const sql = optimizer.optimize({ object: 'accounts' });
expect(sql).toContain('accounts');
Comment on lines +703 to +705
Copy link

Copilot AI Mar 20, 2026

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 registerSchema stored anything: optimizer.optimize({ object: 'accounts' }) returns SQL containing accounts even when no schema is registered (it falls back to SELECT * FROM accounts). Consider asserting on behavior that only occurs when a schema is registered (e.g., a USE INDEX (...) hint when filters match an index).

Suggested change
// Verify the schema was registered by observing optimize behavior
const sql = optimizer.optimize({ object: 'accounts' });
expect(sql).toContain('accounts');
// Verify the schema (and its index) were registered by observing optimize behavior
const sql = optimizer.optimize({
object: 'accounts',
// Filtering on the indexed field should trigger index-based optimization
filter: { name: 'Acme Corp' },
});
// This assertion only holds when the schema (and index) are actually registered
expect(sql).toContain('USE INDEX (idx_name)');

Copilot uses AI. Check for mistakes.
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/protocols/graphql/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ describe('GraphQLPlugin', () => {
it('should install successfully', async () => {
await plugin.install?.({ engine: kernel });

// Plugin should be installed without errors
expect(true).toBe(true);
// Verify the engine reference was stored after installation
expect((plugin as any).engine).toBeDefined();
});
});

Expand Down
9 changes: 4 additions & 5 deletions packages/protocols/graphql/src/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says unknown collections return an empty array, but the assertion only checks Array.isArray(result). Since this integration test uses a MemoryDriver-backed kernel, the unknown-object result is deterministically []; asserting toHaveLength(0) would make this check more meaningful and aligned with the comment.

Suggested change
expect(Array.isArray(result)).toBe(true);
expect(Array.isArray(result)).toBe(true);
expect(result).toHaveLength(0);

Copilot uses AI. Check for mistakes.
} catch (error) {
// Error is also acceptable
// Error is also acceptable — some drivers throw for unknown objects
expect(error).toBeDefined();
}
});
Expand Down
12 changes: 6 additions & 6 deletions packages/protocols/json-rpc/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ describe('JSONRPCPlugin', () => {
it('should install successfully', async () => {
await plugin.install?.({ engine: kernel });

// Plugin should be installed without errors
expect(true).toBe(true);
// Verify the engine reference was stored after installation
expect((plugin as any).engine).toBeDefined();
});

it('should start and stop successfully', async () => {
await plugin.install?.({ engine: kernel });
await plugin.onStart?.({ engine: kernel });

// Plugin should start without errors
expect(true).toBe(true);
// Verify the HTTP server was created and is listening
expect((plugin as any).server?.listening).toBe(true);

await plugin.onStop?.({ engine: kernel });

// Plugin should stop without errors
expect(true).toBe(true);
// Verify the HTTP server stopped accepting connections
expect((plugin as any).server?.listening).toBe(false);
});
});

Expand Down
21 changes: 12 additions & 9 deletions packages/protocols/json-rpc/src/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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
Copy link

Copilot AI Mar 20, 2026

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 an error for null parameters, or adjust the input/comment so the try-branch assertion is meaningful and deterministic.

Copilot uses AI. Check for mistakes.
} 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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says unknown/empty collection names return an empty array, but the assertion only checks Array.isArray(result). With the current MemoryDriver-backed test kernel this is deterministically an empty array; consider asserting toHaveLength(0) to strengthen the signal and match the comment.

Suggested change
expect(Array.isArray(result)).toBe(true);
expect(result).toHaveLength(0);

Copilot uses AI. Check for mistakes.
} catch (error) {
expect(error).toBeDefined();
}
Expand Down
12 changes: 6 additions & 6 deletions packages/protocols/odata-v4/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ describe('ODataV4Plugin', () => {
it('should install successfully', async () => {
await plugin.install?.({ engine: kernel });

// Plugin should be installed without errors
expect(true).toBe(true);
// Verify the engine reference was stored after installation
expect((plugin as any).engine).toBeDefined();
});

it('should start and stop successfully', async () => {
await plugin.install?.({ engine: kernel });
await plugin.onStart?.({ engine: kernel });

// Plugin should start without errors
expect(true).toBe(true);
// Verify the HTTP server was created and is listening
expect((plugin as any).server).toBeDefined();

await plugin.onStop?.({ engine: kernel });

// Plugin should stop without errors
expect(true).toBe(true);
// Verify the HTTP server was torn down
expect((plugin as any).server).toBeUndefined();
});
});

Expand Down
11 changes: 6 additions & 5 deletions packages/protocols/odata-v4/src/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says unknown collections return an empty array, but the assertion only checks Array.isArray(result). Since this test kernel is backed by MemoryDriver, the result for an unknown collection is deterministically []; asserting result.length === 0 (or toHaveLength(0)) would make the check more meaningful and aligned with the comment.

Suggested change
expect(Array.isArray(result)).toBe(true);
expect(result).toHaveLength(0);

Copilot uses AI. Check for mistakes.
} catch (error: any) {
// Error should have proper structure
expect(error).toBeDefined();
Expand Down Expand Up @@ -421,8 +421,9 @@ describe('OData V4 Protocol Integration Tests', () => {
it('should handle malformed requests', async () => {
try {
// Pass invalid query format
await kernel.repository.find('Products', null as any);
expect(true).toBe(true);
const result = await kernel.repository.find('Products', null as any);
// Driver handles null query gracefully — returns records or empty array
expect(result).toBeDefined();
Comment on lines +424 to +426
Copy link

Copilot AI Mar 20, 2026

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).

Copilot uses AI. Check for mistakes.
} catch (error) {
expect(error).toBeDefined();
}
Expand Down
Loading