Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

1.1 KB
Raw Blame
import { describe, expect, it, vi } from 'vitest';
const callMCPTool = vi.fn(async () => ({ success: true }));
vi.mock('../src/mcp-client.js', () => ({ callMCPTool, MCPClientError: class extends Error {} }));
const { hooksCommand } = await import('../src/commands/hooks.js');
const command = hooksCommand.subcommands!.find(c => c.name === 'post-task')!;

describe('post-task CLI patterns (#3445)', () => {
  it('declares the patterns option and forwards parsed JSON', async () => {
    expect(command.options?.some(option => option.name === 'patterns')).toBe(true);
    await command.action!({ args: [], flags: { taskId: '3445', patterns: '["validate first"]', format: 'json' } } as any);
    expect(callMCPTool).toHaveBeenCalledWith('hooks_post-task', expect.objectContaining({ patterns: ['validate first'] }));
  });
  it('rejects malformed JSON without calling MCP', async () => {
    callMCPTool.mockClear();
    expect(await command.action!({ args: [], flags: { patterns: '{' } } as any)).toMatchObject({ success: false });
    expect(callMCPTool).not.toHaveBeenCalled();
  });
});