UNPKG

seraph-agent

Version:

An extremely lightweight, SRE autonomous AI agent for seamless integration with common observability tasks.

32 lines (31 loc) 1.25 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const anthropic_1 = require("../anthropic"); const sdk_1 = __importDefault(require("@anthropic-ai/sdk")); jest.mock('@anthropic-ai/sdk'); describe('AnthropicProvider', () => { const mockedAnthropic = sdk_1.default; it('should call the messages.create method with the correct prompt', async () => { const create = jest.fn().mockResolvedValue({ content: [{ type: 'text', text: 'test response' }], }); mockedAnthropic.prototype.messages = { create }; const config = { port: 8080, workers: 4, apiKey: 'test-key', serverApiKey: null, }; const provider = new anthropic_1.AnthropicProvider(config); const response = await provider.generate('test prompt'); expect(create).toHaveBeenCalledWith({ model: 'claude-3-opus-20240229', max_tokens: 1024, messages: [{ role: 'user', content: 'test prompt' }], }); expect(response).toBe('test response'); }); });