Skip to content

🌱 Add unit tests for useCardRecommendations and useBenchmarkData hooks#3885

Open
shubhamkumar9199 wants to merge 1 commit intokubestellar:mainfrom
shubhamkumar9199:add-unit-tests-useCardRecommendations-useBenchmarkData
Open

🌱 Add unit tests for useCardRecommendations and useBenchmarkData hooks#3885
shubhamkumar9199 wants to merge 1 commit intokubestellar:mainfrom
shubhamkumar9199:add-unit-tests-useCardRecommendations-useBenchmarkData

Conversation

@shubhamkumar9199
Copy link
Copy Markdown

@shubhamkumar9199 shubhamkumar9199 commented Mar 29, 2026

Fixes #3874

📝 Summary of Changes

  • Adds 21 unit tests for useCardRecommendations hook covering thresholds, priority escalation, AI-mode filtering, MAX_RECOMMENDATIONS cap, periodic re-analysis, and graceful handling of undefined data
  • Adds 14 unit tests for useBenchmarkData (useCachedBenchmarkReports) hook covering SSE streaming, cache fallback, demo data handling, auth headers, stream error handling, loading states, and the
    non-streaming fallback endpoint

Changes Made

  • Added web/src/hooks/__tests__/useCardRecommendations.test.ts (21 tests)
  • Added web/src/hooks/__tests__/useBenchmarkData.test.ts (14 tests)

Checklist

  • I used a coding agent (Claude Code, Copilot, Gemini, or Codex) to generate/review this code
  • I have reviewed the project's contribution guidelines
  • New cards target console-marketplace, not this repo
  • isDemoData is wired correctly (cards show Demo badge when using demo data)
  • I have written unit tests for the changes (if applicable)
  • I have tested the changes locally and ensured they work as expected
  • All commits are signed with DCO (git commit -s)

Screenshots or Logs (if applicable)

image ---

👀 Reviewer Notes

All 35 tests pass in ~3s. The act(...) warnings in useBenchmarkData tests are expected,they come from the SSE singleton's async state updates outside React's control and do not affect test correctness.

…hooks (kubestellar#3874)

Signed-off-by: shubhamsharma9199 <shubham.24bcs10320@sst.scaler.com>
@kubestellar-prow kubestellar-prow bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Mar 29, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 29, 2026

Deploy Preview for kubestellarconsole ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 7d13afe
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69c9a9636dea530008f2f6f8
😎 Deploy Preview https://deploy-preview-3885.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

👋 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:

  • DCO Sign-off — All commits signed with git commit -s (DCO)
  • PR Title — Starts with an emoji: ✨ feature | 🐛 bug fix | 📖 docs | 🌱 infra/tests | ⚠️ breaking

📬 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.

@kubestellar-prow kubestellar-prow bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @shubhamkumar9199 — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@shubhamkumar9199 shubhamkumar9199 changed the title test: add unit tests for useCardRecommendations and useBenchmarkData … test: add unit tests for useCardRecommendations and useBenchmarkData hooks Mar 29, 2026
@shubhamkumar9199 shubhamkumar9199 changed the title test: add unit tests for useCardRecommendations and useBenchmarkData hooks Add unit tests for useCardRecommendations and useBenchmarkData hooks Mar 29, 2026
@shubhamkumar9199 shubhamkumar9199 changed the title Add unit tests for useCardRecommendations and useBenchmarkData hooks 🌱 Add unit tests for useCardRecommendations and useBenchmarkData hooks Mar 29, 2026
@shubhamkumar9199
Copy link
Copy Markdown
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 Add unit tests for useCardRecommendations and useBenchmarkData

1 participant