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

import { getProviderBadgeText, getProviderPresetByValue } from '../defaultIcon';

describe('defaultIcon helpers', () => {
  it('使用 lobehub 官方静态 svg 作为默认服务商 logo', () => {
    expect(getProviderPresetByValue('openai')?.icon).toBe(
      '/model-providers/lobehub/openai.svg',
    );
    expect(getProviderPresetByValue('deepseek')?.icon).toBe(
      '/model-providers/lobehub/deepseek.svg',
    );
    expect(getProviderPresetByValue('self-hosted')?.icon).toBe(
      '/model-providers/lobehub/vllm.svg',
    );
  });

  it('可以读取新的服务商预设', () => {
    const preset = getProviderPresetByValue('self-hosted');

    expect(preset?.label).toBe('自部署');
    expect(preset?.mode).toBe('self-hosted');
  });

  it('未知服务商类型会回退到 providerName 文本', () => {
    expect(getProviderBadgeText('历史服务商', 'legacy')).toBe('历史');
    expect(getProviderBadgeText('', 'legacy-provider')).toBe('LE');
  });
});
