✨ Quality: Improve test coverage - useAIPrompt - #88
Conversation
Added comprehensive unit tests to lib/hooks/useAIPrompt.test.ts to cover missing branches in lib/hooks/useAIPrompt.ts. - Added tests for inferContentType covering all visual and audio types. - Added tests for createSession error branches (constructor checks, missing API). - Added tests for prompt and append error handling (non-Error objects, AbortError). - Added tests for warmup failure and component unmount cleanup. - Improved line coverage to >99% and branch coverage to >92%. - Addressed lint errors in the test file.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: This improvement adds 13 new test cases to
lib/hooks/useAIPrompt.test.ts, targeting previously uncovered branches in theuseAIPrompthook.🎯 Why: The
useAIPrompthook had several untested logic paths, particularly around multimodal content type inference and defensive checks for browser-specific AI APIs.📊 Impact:
useAIPrompt.tsincreased from 77.86% to 99.23%.✅ Verification:
pnpm test lib/hooks/useAIPrompt.test.ts(all 26 tests passed).pnpm test:coverageto verify the improvement.pnpm lintto ensure no regression in code quality.PR created automatically by Jules for task 3194697612275854990 started by @galiprandi