Skip to content

test(react): Add stream-error fallback, retry focus tests - #14

Merged
stefashkaa merged 1 commit into
mainfrom
test/add-new-react-test-cases
Sep 30, 2026
Merged

stefashkaa merged 1 commit into
mainfrom
test/add-new-react-test-cases

Conversation

@stefashkaa

@stefashkaa stefashkaa commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Description

  • What does this PR do?

    • Add new test cases for React package
  • Why is this change needed?

    • To follow min test coverage % in CI

Type of Change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • Documentation update
  • Tests
  • Maintenance

Testing

  • pnpm test:unit:coverage

Screenshots (if applicable)

  • N/A

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex code
  • Documentation updated
  • No new warnings generated
  • Tests added/updated
  • All tests passing

Run Coverage Workflow

Maintainers only (write/maintain/admin access): open the workflow, click Run workflow, and set pr_number to this PR number to post/update a coverage comment on this PR

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for localized fallback messages when stream errors have no message, focus retention on the Stop control during busy retries, and cleanup when a widget is unmounted before a pending update completes.
    • These checks help verify that error handling, focus behavior, and widget lifecycle remain consistent in these scenarios.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 22:03
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
context7-widget Skipped Skipped Sep 30, 2026 10:03pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T22:05:19.112718Z ff5bb87 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 34188999-6065-4c9a-8fc6-513b7cd45410

📥 Commits

Reviewing files that changed from the base of the PR and between 2375d0e and ff5bb87.

📒 Files selected for processing (1)
  • packages/react/tests/unit/context7-widget.test.tsx
 ________________________________________________________________
< This is the kind of code that makes on-call believe in ghosts. >
 ----------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@stefashkaa
stefashkaa merged commit 670f17a into main Sep 30, 2026
5 of 6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 localized errorFallback label (.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 second fetch.
  • 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.

@stefashkaa
stefashkaa deleted the test/add-new-react-test-cases branch September 30, 2026 22:10

This branch was previously deployed

1 inactive deployment
Preview — ff5bb87d Deployed Sep 30, 2026 by vercel[bot]
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