agent-ecosystem/mcp-server/test/tools/task-link.test.ts
iliya 161c675aaa feat: update pnpm lockfile and workspace configuration, enhance tool usage tracking and UI components
- Added new dependencies for mcp-server in pnpm-lock.yaml, including fastmcp and zod.
- Updated pnpm-workspace.yaml to include mcp-server in the workspace packages.
- Modified TeamDataService and TeamProvisioningService to exclude 'SendMessage' from tool usage counts, improving accuracy in tool tracking.
- Enhanced ChatHistory component to display context injection percentages, improving user feedback on context usage.
- Updated TeamDetailView to ensure session details are fetched periodically for active tabs, enhancing data freshness.
- Improved ActivityTimeline styling for better visual separation of sessions and messages.
2026-03-06 15:54:55 +02:00

44 lines
1.5 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { register } from '../../src/tools/task-link.js';
import { createMockRunner, createMockServer, ok, fail } from './test-helpers.js';
describe('task_link', () => {
function setup(response = ok('OK task #1 blocked-by #2\n')) {
const runner = createMockRunner(response);
const { server, tools } = createMockServer();
register(server, runner);
return { runner, tool: tools.get('task_link')! };
}
it('builds link CLI args', async () => {
const { runner, tool } = setup();
await tool.execute({
team: 'acme', task_id: '1', operation: 'link',
relationship: 'blocked-by', target_id: '2',
});
expect(runner.execute).toHaveBeenCalledWith([
'--team', 'acme', 'task', 'link', '1', '--blocked-by', '2',
]);
});
it('builds unlink CLI args', async () => {
const { runner, tool } = setup(ok('OK task #1 unlinked from #2\n'));
await tool.execute({
team: 'acme', task_id: '1', operation: 'unlink',
relationship: 'related', target_id: '3',
});
expect(runner.execute).toHaveBeenCalledWith([
'--team', 'acme', 'task', 'unlink', '1', '--related', '3',
]);
});
it('throws on CLI failure', async () => {
const { tool } = setup(fail('circular dependency'));
await expect(
tool.execute({
team: 'acme', task_id: '1', operation: 'link',
relationship: 'blocked-by', target_id: '1',
}),
).rejects.toThrow('Failed to link tasks');
});
});