mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-02-09 16:41:32 +01:00
test(ai): add debug logging verification spec
- Add tests for AI debug logging functionality - Verify debug logs appear when ZSH_AUTOSUGGEST_AI_DEBUG=1 - Verify debug logs hidden when debug mode disabled This spec ensures the AI strategy properly logs diagnostic information when debug mode is enabled, helping users troubleshoot API key issues and other AI-related problems. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cd66c5695a
commit
8f1d53df7a
1 changed files with 25 additions and 0 deletions
25
spec/strategies/ai_debug_spec.rb
Normal file
25
spec/strategies/ai_debug_spec.rb
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue