UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

33 lines (27 loc) 1.45 kB
import { QueryExpander, QueryType } from '../queryExpander'; describe('QueryExpander', () => { const expander = new QueryExpander({ expansionDegree: 2 }); it('should classify queries correctly', () => { expect(expander.classify('What is AI?')).toBe('factual'); expect(expander.classify('Explain quantum computing')).toBe('conceptual'); expect(expander.classify('How to bake bread')).toBe('procedural'); expect(expander.classify('AI?')).toBe('ambiguous'); expect(expander.classify('Custom query')).toBe('other'); }); it('should expand queries based on type', () => { expect(expander.expand('AI?', 'ambiguous')).toContain('자세히 설명'); expect(expander.expand('What is AI?', 'factual')).toContain('정확한 정보'); expect(expander.expand('Explain quantum computing', 'conceptual')).toContain('정의, 배경'); expect(expander.expand('How to bake bread', 'procedural')).toContain('단계별 설명'); }); it('should reformulate queries for vector search', () => { const q = 'What is the process of baking bread in the oven?'; const reform = expander.reformulate(q); expect(reform).not.toMatch(/\bthe\b|\bof\b|\bin\b|\bis\b/); expect(reform.length).toBeLessThan(q.length); }); it('should store feedback if enabled', () => { expander.feedback('AI?', 'AI 자세히 설명', true, 'Good result'); expect(expander.getFeedbacks().length).toBeGreaterThan(0); }); });