import { setVoiceEnabled, speak } from '../utils/voice';

describe('Voice Functionality Tests', () => {
  afterEach(() => {
    // Clean up - disable voice after each test
    setVoiceEnabled(false);
  });

  it('should enable and disable voice correctly', () => {
    // Test voice enabling
    setVoiceEnabled(true);
    
    // Speak a test message (this should work if voice is enabled)
    speak('Voice test: Hello from the agency-x test suite!');
    
    console.log('✅ Voice enabled and test message spoken');
    
    // Test voice disabling
    setVoiceEnabled(false);
    speak('This message should not be spoken');
    
    console.log('✅ Voice disabled successfully');
  });

  it('should not speak when voice is disabled by default', () => {
    // Voice should be disabled by default
    speak('This should not be heard');
    
    console.log('✅ Default voice state (disabled) working correctly');
  });

  it('should handle multiple voice messages when enabled', () => {
    setVoiceEnabled(true);
    
    const messages = [
      'First voice test message',
      'Second voice test message', 
      'Voice functionality test completed successfully'
    ];
    
    messages.forEach((message, index) => {
      speak(message);
      console.log(`📢 Spoke message ${index + 1}: ${message}`);
    });
    
    console.log('✅ Multiple voice messages test completed');
  });
});
