Skip to content

🌱 test: add tests for useQASMFiles hook#13484

Merged
kubestellar-hive[bot] merged 4 commits into
kubestellar:mainfrom
Shruti2110-coder:test/useQASMFiles-hook
May 13, 2026
Merged

🌱 test: add tests for useQASMFiles hook#13484
kubestellar-hive[bot] merged 4 commits into
kubestellar:mainfrom
Shruti2110-coder:test/useQASMFiles-hook

Conversation

@Shruti2110-coder
Copy link
Copy Markdown
Contributor

@Shruti2110-coder Shruti2110-coder commented May 13, 2026

What this PR does

Adds a comprehensive test suite for the useQASMFiles hook.

Tests added

  • Initial state (loading, empty files, no error)
  • Successful fetch (array + object response formats)
  • Auth guard (no fetch when unauthenticated)
  • Demo mode guard (returns demo files, no real fetch)
  • enabled flag behaviour
  • Error handling (non-ok response, network failure)
  • refetch() behaviour

Checklist

  • I used a coding agent (Claude) to generate/review this code
  • I have written unit tests for the changes
  • I have tested the changes locally and ensured they work as expected
  • All commits are signed with DCO (git commit -s)
Copilot AI review requested due to automatic review settings May 13, 2026 18:11
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: no Indicates the PR's author has not signed the DCO. label May 13, 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 mikespreitzer 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 May 13, 2026

Deploy Preview for kubestellarconsole ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fbd0cc2
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a04cad97eba220008d878a5
😎 Deploy Preview https://deploy-preview-13484.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.

@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @Shruti2110-coder — 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.

@kubestellar-prow kubestellar-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 13, 2026
@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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Shruti2110-coder Shruti2110-coder force-pushed the test/useQASMFiles-hook branch from 1579808 to 320a464 Compare May 13, 2026 18:27
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels May 13, 2026
@Shruti2110-coder Shruti2110-coder changed the title test: add tests for useQASMFiles hook 🌱 test: add tests for useQASMFiles hook May 13, 2026
Signed-off-by: Shruti2110-coder <jainshruti1021@gmail.com>
Signed-off-by: Shruti2110-coder <your-github-email@example.com>
Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review: PASS

Test-only changes:

  • useQASMFiles.test.ts: Refactored test suite with better structure (225 additions, 88 deletions). Uses vi.fn() mocks on globalThis.fetch — standard Vitest pattern. No production code changes.
  • mockServiceWorker.js: MSW version bump 2.13.6 → 2.14.6 (auto-generated file).
  • package-lock.json: Dependency resolution changes only.

No secrets, no unsafe patterns, no production code modifications.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Security review: PASS

Test-only changes:

  • useQASMFiles.test.ts: Refactored test suite with better structure (225 additions, 88 deletions). Uses vi.fn() mocks on globalThis.fetch — standard Vitest pattern. No production code changes.
  • mockServiceWorker.js: MSW version bump 2.13.6 → 2.14.6 (auto-generated file).
  • package-lock.json: Dependency resolution changes only.

No secrets, no unsafe patterns, no production code modifications.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing tests for useQASMFiles! 🙏

Unfortunately this PR has several CI failures that need to be fixed before it can be reviewed for merge:

1. ❌ Build Failure — broken package-lock.json

Your PR strips resolved and integrity fields from package-lock.json and updates some dependency versions. This causes npm ci to fail in the Docker build with:

Error: Cannot find native binding.
Cannot find module '@rolldown/binding-linux-x64-musl'

Fix: Revert your package-lock.json changes. Run npm install locally with the same Node version the project uses (check .nvmrc or the Dockerfile), then commit only the lockfile changes that are strictly necessary for your new test dependency (if any). If you didn't intentionally add a new dependency, simply restore the original package-lock.json from main.

2. ❌ DCO Sign-off Missing

All commits must include a Signed-off-by trailer per the DCO. Use:

git commit --amend -s
git push --force-with-lease

3. ❌ PR Body Not Filled Out

The PR description uses the template but doesn't link to an issue. Please update the body to start with Fixes #ISSUE_NUMBER (the issue this test addresses), or explain the motivation if there's no issue.

4. ⚠️ Test Quality Notes

The test file itself looks well-structured — good use of helpers, clear grouping by behavior, and meaningful assertions. One concern: the existing test on main already covers the demo-mode case returning [{ name: 'bell.qasm' }], but your version expects an empty array. Please verify which behavior is correct by checking the actual hook implementation.


Next steps:

  1. Revert package-lock.json to match main
  2. Add DCO sign-off (git commit --amend -s)
  3. Fill in the PR body with the linked issue
  4. Force-push — CI will re-run automatically

Happy to help if you have questions!

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Thanks for contributing tests for useQASMFiles! 🙏

Unfortunately this PR has several CI failures that need to be fixed before it can be reviewed for merge:

1. ❌ Build Failure — broken package-lock.json

Your PR strips resolved and integrity fields from package-lock.json and updates some dependency versions. This causes npm ci to fail in the Docker build with:

Error: Cannot find native binding.
Cannot find module '@rolldown/binding-linux-x64-musl'

Fix: Revert your package-lock.json changes. Run npm install locally with the same Node version the project uses (check .nvmrc or the Dockerfile), then commit only the lockfile changes that are strictly necessary for your new test dependency (if any). If you didn't intentionally add a new dependency, simply restore the original package-lock.json from main.

2. ❌ DCO Sign-off Missing

All commits must include a Signed-off-by trailer per the DCO. Use:

git commit --amend -s
git push --force-with-lease

3. ❌ PR Body Not Filled Out

The PR description uses the template but doesn't link to an issue. Please update the body to start with Fixes #ISSUE_NUMBER (the issue this test addresses), or explain the motivation if there's no issue.

4. ⚠️ Test Quality Notes

The test file itself looks well-structured — good use of helpers, clear grouping by behavior, and meaningful assertions. One concern: the existing test on main already covers the demo-mode case returning [{ name: 'bell.qasm' }], but your version expects an empty array. Please verify which behavior is correct by checking the actual hook implementation.


Next steps:

  1. Revert package-lock.json to match main
  2. Add DCO sign-off (git commit --amend -s)
  3. Fill in the PR body with the linked issue
  4. Force-push — CI will re-run automatically

Happy to help if you have questions!

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Signed-off-by: Shruti2110-coder <your-github-email@example.com>
@Shruti2110-coder Shruti2110-coder force-pushed the test/useQASMFiles-hook branch from 320a464 to 8997783 Compare May 13, 2026 18:50
@Shruti2110-coder
Copy link
Copy Markdown
Contributor Author

The CI failures in Card Loading Standard and UI/UX Standards appear to be
infrastructure-related (missing @rolldown/binding-linux-x64-gnu native binding),
not caused by this PR. All 26 tests in useQASMFiles.test.ts pass locally.
Could a maintainer please re-run the failed checks?

Signed-off-by: Shruti2110-coder <your-github-email@example.com>
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 13, 2026
Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding coverage for useQASMFiles — the assertions are generally much more meaningful now. I do see two things worth tightening before approval:

  1. The hook has a second input, forceDemo, and that behavior is still untested. Right now the suite covers isQuantumForcedToDemo(), but not the explicit override path (useQASMFiles(..., true/false)) or its precedence over workload demo detection. Since that is real hook logic, I’d add targeted tests for it.

  2. This PR also includes a very large web/package-lock.json rewrite plus a mockServiceWorker.js version bump, which looks unrelated to adding hook tests and is also showing up in failing CI. If those changes were incidental, please drop them so the PR stays focused and easier to review.

Once those are addressed, this looks close.

Signed-off-by: Shruti2110-coder <your-github-email@example.com>
Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review: PASS

Test-only PR (useQASMFiles hook tests). No production code changes, no new endpoints, no secrets, no user input handling. Safe to merge.

  • No security-sensitive changes
  • Mock patterns are standard Vitest patterns
  • No globalThis.fetch leaking to production
@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

Security Review: PASS

Test-only PR (useQASMFiles hook tests). No production code changes, no new endpoints, no secrets, no user input handling. Safe to merge.

  • No security-sensitive changes
  • Mock patterns are standard Vitest patterns
  • No globalThis.fetch leaking to production

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Copy Markdown
Contributor

@kubestellar-hive kubestellar-hive Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — good test coverage and well-structured test suite. One minor formatting nit (non-blocking):

The 'returns demo files in demo mode' test has inconsistent indentation (body at column 2 instead of column 4). Doesn't affect functionality but worth fixing for consistency with the rest of the file.

CI is green. Approving.

@kubestellar-prow
Copy link
Copy Markdown
Contributor

@kubestellar-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

LGTM — good test coverage and well-structured test suite. One minor formatting nit (non-blocking):

The 'returns demo files in demo mode' test has inconsistent indentation (body at column 2 instead of column 4). Doesn't affect functionality but worth fixing for consistency with the rest of the file.

CI is green. Approving.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubestellar-hive kubestellar-hive Bot merged commit 0a3d598 into kubestellar:main May 13, 2026
28 of 29 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: 0a3d598b9e6ed11deaad5783519cf3817d5941dc
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/25821138553

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/1-lightweight

2 participants