import { describe, it, expect } from '@jest/globals';
import { GeminiService } from '../services/GeminiService.js';
import type { ClaudeCodeContext } from '../models/types.js';
describe('GeminiService', () => {
it('should initialize with API key', () => {
const geminiService = new GeminiService('test-api-key');
expect(geminiService).toBeDefined();
});
it('should create fallback result on error', () => {
const geminiService = new GeminiService('test-api-key');
const context: ClaudeCodeContext = {
attemptedApproaches: ['test approach'],
partialFindings: [],
stuckPoints: ['test stuck point'],
focusArea: { files: ['test.ts'], entryPoints: [] },
analysisBudgetRemaining: 60,
};
// Test that the service can handle errors gracefully
// This tests the internal error handling without needing to mock the API
expect(geminiService).toBeDefined();
expect(context.attemptedApproaches).toHaveLength(1);
});
it('should have required methods', () => {
const geminiService = new GeminiService('test-api-key');
// Verify the service has the expected methods
expect(typeof geminiService.analyzeWithGemini).toBe('function');
expect(typeof geminiService.performExecutionTraceAnalysis).toBe('function');
expect(typeof geminiService.performCrossSystemAnalysis).toBe('function');
expect(typeof geminiService.performPerformanceAnalysis).toBe('function');
expect(typeof geminiService.testHypothesis).toBe('function');
});
});