Files
flynn/src/cli/send.test.ts
T

26 lines
895 B
TypeScript

import { describe, it, expect, vi } from 'vitest';
import { createSendAgent } from './send.js';
import type { ChatRequest, ChatResponse } from '../models/types.js';
describe('send command', () => {
it('createSendAgent creates an agent that can process a message', async () => {
// Mock model client that returns a canned response
const mockModelClient = {
chat: vi.fn().mockImplementation(async (_request: ChatRequest): Promise<ChatResponse> => ({
content: 'Hello from Flynn!',
stopReason: 'end_turn',
usage: { inputTokens: 10, outputTokens: 5 },
})),
};
const agent = createSendAgent({
modelClient: mockModelClient,
systemPrompt: 'You are Flynn.',
});
const response = await agent.process('Hi there');
expect(response).toBe('Hello from Flynn!');
expect(mockModelClient.chat).toHaveBeenCalledOnce();
});
});