Skip to content

Commit d503320

Browse files
committed
test: add agent-tools registration coverage
- Add tests for registerGatewayTools function - Add tests for registerDynamicTools function - Test that tools can be registered without throwing errors - Uses proper mocking for ToolRegistry Coverage: agent-tools.ts 3.27% → 10.8% (+7.53%)
1 parent 00cee96 commit d503320

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

packages/gateway/src/routes/agent-tools.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,44 @@ describe('agent-tools helpers', () => {
188188
expect(safeStringArray(input)).toEqual(['hello\nworld', 'tab\there', 'emoji😀', '']);
189189
});
190190
});
191+
192+
// =========================================================================
193+
// registerGatewayTools
194+
// =========================================================================
195+
describe('registerGatewayTools', () => {
196+
it('registers tools without throwing', async () => {
197+
const { registerGatewayTools } = await import('./agent-tools.js');
198+
const mockToolRegistry = {
199+
register: vi.fn(),
200+
unregister: vi.fn(),
201+
has: vi.fn(),
202+
execute: vi.fn(),
203+
list: vi.fn(),
204+
};
205+
206+
// Should not throw
207+
expect(() => registerGatewayTools(mockToolRegistry as any, 'test-user', false)).not.toThrow();
208+
});
209+
});
210+
211+
// =========================================================================
212+
// registerDynamicTools
213+
// =========================================================================
214+
describe('registerDynamicTools', () => {
215+
it('registers dynamic tools without throwing', async () => {
216+
const { registerDynamicTools } = await import('./agent-tools.js');
217+
const mockToolRegistry = {
218+
register: vi.fn(),
219+
unregister: vi.fn(),
220+
has: vi.fn(),
221+
execute: vi.fn(),
222+
list: vi.fn(),
223+
};
224+
225+
// Should not throw
226+
await expect(
227+
registerDynamicTools(mockToolRegistry as any, 'test-user', 'conv-123', false)
228+
).resolves.not.toThrow();
229+
});
230+
});
191231
});

0 commit comments

Comments
 (0)