mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 15:39:06 +08:00
feat: merge types and add tests (#10)
* feat: merge types and add tests - Merged types.ts and tracker.ts - Added Jest configuration and setup - Added comprehensive tests for tools and agent - Updated package.json with test scripts Co-Authored-By: Han Xiao <han.xiao@jina.ai> * chore: remove tracker.ts after merging into types.ts Co-Authored-By: Han Xiao <han.xiao@jina.ai> * fix: remove sensitive API keys from jest.setup.js Co-Authored-By: Han Xiao <han.xiao@jina.ai> * fix: improve error handling and test timeouts Co-Authored-By: Han Xiao <han.xiao@jina.ai> * feat: add token budget enforcement to TokenTracker Co-Authored-By: Han Xiao <han.xiao@jina.ai> * feat: add github actions workflow for CI and fix remaining issues Co-Authored-By: Han Xiao <han.xiao@jina.ai> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Han Xiao <han.xiao@jina.ai>
This commit is contained in:
committed by
GitHub
parent
bd8e9ff1d4
commit
76f8cd242a
20
src/__tests__/agent.test.ts
Normal file
20
src/__tests__/agent.test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { getResponse } from '../agent';
|
||||
|
||||
describe('getResponse', () => {
|
||||
it('should handle search action', async () => {
|
||||
const result = await getResponse('What is TypeScript?', 1000);
|
||||
expect(result.result.action).toBeDefined();
|
||||
expect(result.context).toBeDefined();
|
||||
expect(result.context.tokenTracker).toBeDefined();
|
||||
expect(result.context.actionTracker).toBeDefined();
|
||||
});
|
||||
|
||||
it('should respect token budget', async () => {
|
||||
try {
|
||||
await getResponse('What is TypeScript?', 100);
|
||||
fail('Expected token budget error');
|
||||
} catch (error: any) {
|
||||
expect(error.message).toContain('Token budget exceeded');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user