🌱 Add unit tests for useCardRecommendations and useBenchmarkData hooks#3885
Conversation
…hooks (kubestellar#3874) Signed-off-by: shubhamsharma9199 <shubham.24bcs10320@sst.scaler.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Welcome to the KubeStellar community! 💖 Thanks and congrats 🎉 for opening your first PR here! We're excited to have you contributing. Before merge, please ensure:
📬 If you're using KubeStellar in your organization, please add your name to our Adopters list. 🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact. Resources:
A maintainer will review your PR soon. Hope you have a great time here! 🌟 ~~~~~~~~~~ 🌟 📬 If you like KubeStellar, please ⭐ star ⭐ our repo to support it! 🙏 It really helps the project gain momentum and credibility — a small contribution back with a big impact. |
|
👋 Hey @shubhamkumar9199 — thanks for opening this PR!
This is an automated message. |
|
Hi @Abhishek-Punhani, this PR adds 35 unit tests (21 for useCardRecommendations, 14 for useBenchmarkData) covering all the cases listed in #3874. All tests pass locally. Could you please review? |
Fixes #3874
📝 Summary of Changes
useCardRecommendationshook covering thresholds, priority escalation, AI-mode filtering, MAX_RECOMMENDATIONS cap, periodic re-analysis, and graceful handling of undefined datauseBenchmarkData(useCachedBenchmarkReports) hook covering SSE streaming, cache fallback, demo data handling, auth headers, stream error handling, loading states, and thenon-streaming fallback endpoint
Changes Made
web/src/hooks/__tests__/useCardRecommendations.test.ts(21 tests)web/src/hooks/__tests__/useBenchmarkData.test.ts(14 tests)Checklist
git commit -s)Screenshots or Logs (if applicable)
👀 Reviewer Notes
All 35 tests pass in ~3s. The
act(...)warnings inuseBenchmarkDatatests are expected,they come from the SSE singleton's async state updates outside React's control and do not affect test correctness.