/**
* get_tasks 工具测试
*/
/// <reference path="../global.d.ts" />
import { getTasks } from '../../src/tools/getTasks';
describe('get_tasks Tool', () => {
beforeEach(() => {
global.testCache.clear();
});
test('should fetch task list successfully', async () => {
const result = await getTasks(global.testClient, global.testCache, {
projectId: 2,
page: 1,
limit: 50
});
expect(result).toBeDefined();
expect(result.content).toBeDefined();
const text = result.content[0].text;
expect(text).toContain('任务');
console.log(`✅ Fetched task list`);
});
test('should filter tasks by status', async () => {
const result = await getTasks(global.testClient, global.testCache, {
projectId: 2,
status: 'doing'
});
expect(result).toBeDefined();
console.log(`✅ Filtered tasks by status`);
});
test('should cache task list', async () => {
const cacheKey = 'tasks:{"projectId":2,"page":1,"limit":50}';
await getTasks(global.testClient, global.testCache, {
projectId: 2,
page: 1,
limit: 50
});
const cached = global.testCache.get(cacheKey);
expect(cached).toBeDefined();
console.log(`✅ Task list cached`);
});
});