import { describe, expect, test } from 'vitest';
import { qualityIssueLabel, qualityIssueOptions, qualityProtocolLabel, qualityProtocolOptions } from './qualityIssue';

describe('qualityIssueLabel', () => {
  test('maps no-source issues to a vehicle-service label', () => {
    expect(qualityIssueLabel('NO_SOURCE')).toBe('暂无数据来源');
  });

  test('keeps unknown issue types visible', () => {
    expect(qualityIssueLabel('CUSTOM_GAP')).toBe('CUSTOM_GAP');
  });
});

describe('qualityProtocolLabel', () => {
  test('labels vehicle-level quality issues as vehicle service', () => {
    expect(qualityProtocolLabel('VEHICLE_SERVICE')).toBe('车辆服务');
  });
});

describe('qualityProtocolOptions', () => {
  test('includes vehicle service and all ingestion sources', () => {
    expect(qualityProtocolOptions.map((item) => item.value)).toEqual([
      'VEHICLE_SERVICE',
      'GB32960',
      'JT808',
      'YUTONG_MQTT'
    ]);
  });
});

describe('qualityIssueOptions', () => {
  test('includes issue types used by governance filters', () => {
    expect(qualityIssueOptions.map((item) => item.value)).toContain('NO_SOURCE');
    expect(qualityIssueOptions.map((item) => item.value)).toContain('VIN_MISSING');
  });
});
