diff --git a/spec/strategies/ai_debug_spec.rb b/spec/strategies/ai_debug_spec.rb new file mode 100644 index 0000000..57b1b4c --- /dev/null +++ b/spec/strategies/ai_debug_spec.rb @@ -0,0 +1,25 @@ +describe 'the `ai` strategy debug logging' do + let(:options) { ["ZSH_AUTOSUGGEST_STRATEGY=(ai)"] } + + context 'when debug is enabled' do + let(:options) do + [ + "ZSH_AUTOSUGGEST_STRATEGY=(ai)", + "ZSH_AUTOSUGGEST_AI_DEBUG=1" + ] + end + + it 'logs why AI suggestion is skipped when API key is missing' do + session.send_string('brew') + wait_for { session.content }.to match(/\[zsh-autosuggestions ai\] API key not set/) + end + end + + context 'when debug is disabled by default' do + it 'does not print AI debug logs' do + session.send_string('brew') + sleep 0.2 + expect(session.content).not_to match(/\[zsh-autosuggestions ai\]/) + end + end +end