UNPKG

seraph-agent

Version:

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

29 lines (28 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const gemini_1 = require("../gemini"); const generative_ai_1 = require("@google/generative-ai"); jest.mock('@google/generative-ai'); describe('GeminiProvider', () => { const mockedGoogleGenerativeAI = generative_ai_1.GoogleGenerativeAI; it('should call the generateContent method with the correct prompt', async () => { const generateContent = jest.fn().mockResolvedValue({ response: { text: () => 'test response', }, }); mockedGoogleGenerativeAI.prototype.getGenerativeModel = jest.fn().mockReturnValue({ generateContent, }); const config = { port: 8080, workers: 4, apiKey: 'test-key', serverApiKey: null, }; const provider = new gemini_1.GeminiProvider(config); const response = await provider.generate('test prompt'); expect(generateContent).toHaveBeenCalledWith('test prompt'); expect(response).toBe('test response'); }); });