test(react): Add stream-error fallback, retry focus tests - #14
Conversation
…es after unmount tests
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is test-only and each new assertion was verified to match the existing engine, component, and hook behavior with no production code affected.
Review effort: Balanced
Findings: None
What changed in this PR
This PR adds three unit tests to the React package (@desource/context7-widget-react) to raise/maintain the minimum test-coverage threshold enforced in CI. The tests exercise previously uncovered branches of the widget's conversation and lifecycle logic. I verified each assertion against the underlying implementation (packages/core/src/engine.ts, packages/react/src/components/Context7Widget.tsx, and packages/react/src/hooks/useContext7Widget.ts) and all three tests are consistent with actual behavior.
Changes:
- Add a test asserting that an empty-message stream error resolves to
{ error: '', status: 'error' }and renders the localizederrorFallbacklabel (.c7-message--error). - Extend the composition/focus test to confirm that calling
retry()while a request is in flight keeps focus on the Stop control and does not trigger a secondfetch. - Add a hook lifecycle regression test confirming an owned widget is not recreated when
unmount()runs before a queued prop-update microtask (guarded by!containerRef.current).
| File | Description |
|---|---|
| packages/react/tests/unit/context7-widget.test.tsx | Adds three unit tests (stream-error fallback, retry focus retention, unmount-before-queued-update) covering engine error handling, focus management, and hook lifecycle guards. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Description
What does this PR do?
Why is this change needed?
Type of Change
Testing
pnpm test:unit:coverageScreenshots (if applicable)
Checklist
Maintainers only (
write/maintain/adminaccess): open the workflow, clickRun workflow, and setpr_numberto this PR number to post/update a coverage comment on this PRSummary by CodeRabbit