import { describe, expect, it } from 'vitest';

import { describeSourceFileExtractionStatus } from './sourceFileExtractionStatus';

describe('describeSourceFileExtractionStatus', () => {
  it('summarizes successful and failed extraction states for file lists', () => {
    expect(describeSourceFileExtractionStatus({
      extraction_status: 'llm_succeeded',
      extracted_material_count: 3,
      extraction_summary: '提取 3 项',
    }).label).toBe('识别成功 3 项');

    expect(describeSourceFileExtractionStatus({
      extraction_status: 'llm_failed',
      extraction_error: 'GLM 返回非法 JSON',
    }).label).toBe('识别失败');

    expect(describeSourceFileExtractionStatus({
      extraction_status: null,
    }).label).toBe('仅附件');
  });
});
