Skip to content

Add coverage for useBlochScene hook behavior - #18

Merged
itsubaki merged 3 commits into
mainfrom
copilot/add-tests-for-hooks-use-bloch-scene
Apr 3, 2026
Merged

Add coverage for useBlochScene hook behavior#18
itsubaki merged 3 commits into
mainfrom
copilot/add-tests-for-hooks-use-bloch-scene

Conversation

Copilot AI commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

hooks/use-bloch-scene.ts had no direct test coverage despite owning non-trivial scene lifecycle and interaction logic. This adds focused hook tests around initialization, prop-driven updates, and teardown behavior.

  • Hook lifecycle coverage

    • Adds a dedicated use-bloch-scene.test.tsx suite for the hook.
    • Verifies the scene mounts a renderer, initializes the camera, and applies the expected background color.
  • Interaction and state update coverage

    • Exercises camera movement via input events and verifies resetCamera restores the default view.
    • Verifies window resize updates renderer dimensions and camera aspect ratio.
    • Verifies quantumState changes replace the rendered Bloch vector.
    • Verifies isDarkMode changes regenerate label textures and update the scene background.
  • Cleanup coverage

    • Verifies unmount removes DOM listeners, cancels animation, detaches the canvas, and disposes renderer resources.

Example of the behavior now covered:

const { rerender } = render(
  <TestComponent isDarkMode quantumState={initialState} />,
)

rerender(
  <TestComponent isDarkMode={false} quantumState={nextState} />,
)

This captures the two core update paths in the hook: scene restyling on theme changes and vector replacement on quantum state changes.

Copilot AI and others added 3 commits April 3, 2026 11:31
Agent-Logs-Url: https://github.com/itsubaki/bloch/sessions/a06a39f0-d704-4753-a1b4-40b387ba395f

Co-authored-by: itsubaki <1759459+itsubaki@users.noreply.github.com>
Agent-Logs-Url: https://github.com/itsubaki/bloch/sessions/a06a39f0-d704-4753-a1b4-40b387ba395f

Co-authored-by: itsubaki <1759459+itsubaki@users.noreply.github.com>
Agent-Logs-Url: https://github.com/itsubaki/bloch/sessions/a06a39f0-d704-4753-a1b4-40b387ba395f

Co-authored-by: itsubaki <1759459+itsubaki@users.noreply.github.com>
@vercel

vercel Bot commented Apr 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bloch Ready Ready Preview, Comment, Open in v0 Apr 3, 2026 0:04am

@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.16%. Comparing base (b8e8063) to head (6cdbc83).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##              main      #18       +/-   ##
============================================
- Coverage   100.00%   80.16%   -19.84%     
============================================
  Files            8       12        +4     
  Lines           63      373      +310     
  Branches        11       52       +41     
============================================
+ Hits            63      299      +236     
- Misses           0       58       +58     
- Partials         0       16       +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@itsubaki
itsubaki marked this pull request as ready for review April 3, 2026 12:07
@itsubaki
itsubaki merged commit c504b42 into main Apr 3, 2026
4 of 5 checks passed
@itsubaki
itsubaki deleted the copilot/add-tests-for-hooks-use-bloch-scene branch April 3, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants