import { describe, it, expect } from 'vitest';
import { supportsAudioInput } from './capabilities.js';

describe('supportsAudioInput', () => {
  describe('audio-capable providers with modern models', () => {
    it('returns true for gemini with a modern model', () => {
      expect(supportsAudioInput('gemini', 'gemini-1.5-pro')).toBe(true);
    });

    it('returns true for openai with a modern model', () => {
      expect(supportsAudioInput('openai', 'gpt-4o')).toBe(true);
    });

    it('returns true for github with a modern model', () => {
      expect(supportsAudioInput('github', 'gpt-4o')).toBe(true);
    });
  });

  describe('non-audio providers return false', () => {
    const nonAudioProviders = [
      'anthropic',
      'bedrock',
      'ollama',
      'llamacpp',
      'openrouter',
      'zhipuai',
      'xai',
    ] as const;

    for (const provider of nonAudioProviders) {
      it(`returns false for ${provider}`, () => {
        expect(supportsAudioInput(provider, 'some-model')).toBe(false);
      });
    }
  });

  describe('model-specific exclusions', () => {
    const excludedModels = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo'];

    for (const model of excludedModels) {
      it(`returns false for openai/${model} despite provider being capable`, () => {
        expect(supportsAudioInput('openai', model)).toBe(false);
      });

      it(`returns false for github/${model} despite provider being capable`, () => {
        expect(supportsAudioInput('github', model)).toBe(false);
      });
    }
  });

  describe('unknown provider', () => {
    it('returns false for a completely unknown provider', () => {
      expect(supportsAudioInput('unknown-provider', 'some-model')).toBe(false);
    });

    it('returns false for an empty string provider', () => {
      expect(supportsAudioInput('', 'some-model')).toBe(false);
    });
  });
});
