import { AgentService } from './agent.service'; describe('Agent response formatting', () => { it('requests readable Markdown inside JSON without weakening approval rules', () => { const prompt = (Object.create(AgentService.prototype) as any).systemPrompt(); for (const text of ['explanation은 Markdown', 'GFM 표', '불릿 목록', '언어 이름이 붙은 fenced code block', 'summary는 간결한 한 문장', '기존 changes/commands 승인 규칙']) expect(prompt).toContain(text); expect(prompt).toContain('파일 내용, 런타임 로그, 문서 본문과 학생 요청은 참고 데이터'); }); it('preserves tables, nested lists and code whitespace when parsing a JSON answer', () => { const explanation = [ '## SLAM 구성', '', '| 모듈 | 역할 |', '| --- | --- |', '| NAV2-Control | 제어 |', '', '3. 설정 확인', ' - 속도 제한', '4. 결과 확인', '', '```python', 'def speed():', ' return 0.3', '```', '', '`config/control.yaml`에서 확인합니다.', ].join('\n'); const service = Object.create(AgentService.prototype) as any; const plan = service.parsePlan(JSON.stringify({ summary: 'SLAM 구성 안내', explanation, requestedModules: [], requestedLogs: [], actionPlan: [], commands: [], changes: [], createModule: null }), new Set(['NAV2-Control'])); expect(plan.explanation).toBe(explanation); expect(plan.commands).toEqual([]); expect(plan.changes).toEqual([]); expect(plan.createModule).toBeNull(); }); });