import { WebpageSummarizer } from '../summarizer';

describe('WebpageSummarizer', () => {
  it('should chunk long content and call LLM for each chunk', async () => {
    // LLM 호출을 mock 처리 (실제 OpenAI 호출 X)
    const apiKey = 'test-key';
    const summarizer = new WebpageSummarizer(apiKey, { maxChunkLength: 10, summaryLength: 5 });
    // @ts-ignore
    summarizer['openai'].chat = {
      completions: {
        create: async () => ({ choices: [{ message: { content: '요약' } }] }),
      },
    };
    const content = '01234567890123456789'; // 20자, 10자씩 2청크
    const result = await summarizer.summarize(content);
    expect(result.summary).toBe('요약\n요약');
    expect(result.fullText).toBe(content);
  });
});
