import { describe, it, expect, beforeEach, vi } from 'vitest' import { POST } from '@/app/api/chat/route' import { NextRequest } from 'next/server' import { resetFlagsCache } from '@/lib/flags' describe('Diff Tool - Disabled Flag', () => { beforeEach(() => { resetFlagsCache() vi.clearAllMocks() process.env.IMAGE_UPLOADS_ENABLED = 'true' process.env.DIFF_TOOL_ENABLED = 'false' process.env.OPENROUTER_API_KEY = 'test-key' process.env.OPENROUTER_MODEL = 'openai/gpt-oss-120b' }) it('accepts chat requests when diff tool is disabled', async () => { const request = new NextRequest('http://localhost:3000/api/chat', { method: 'POST', body: JSON.stringify({ message: 'Show me the changes', agentId: 'agent-1', sessionId: 'test-session', timestamp: new Date().toISOString(), }), }) const response = await POST(request) // Should return 200 expect(response.status).toBe(200) }) it('accepts chat requests when diff tool is enabled', async () => { process.env.DIFF_TOOL_ENABLED = 'true' resetFlagsCache() const request = new NextRequest('http://localhost:3000/api/chat', { method: 'POST', body: JSON.stringify({ message: 'Show me the changes', agentId: 'agent-1', sessionId: 'test-session', timestamp: new Date().toISOString(), }), }) const response = await POST(request) // Should return 200 expect(response.status).toBe(200) }) })