Skip to content

testing: cover feedback widget behavior#383

Merged
RtlZeroMemory merged 1 commit intomainfrom
feature/testing-feedback-widget-behavior
Apr 15, 2026
Merged

testing: cover feedback widget behavior#383
RtlZeroMemory merged 1 commit intomainfrom
feature/testing-feedback-widget-behavior

Conversation

@RtlZeroMemory
Copy link
Copy Markdown
Owner

@RtlZeroMemory RtlZeroMemory commented Apr 14, 2026

Summary

  • rewrite the weak infoWidgets tests around visible behavior for public feedback widgets
  • cover empty, errorDisplay, and callout at widget-render fidelity instead of prop-shape assertions
  • keep exact centering, border geometry, and theme-detail styling out of scope because they are not tightly specified public contracts

Families and systems covered

  • feedback widgets: empty, errorDisplay, and callout

Tests added, rewritten, removed

  • rewrote packages/core/src/widgets/__tests__/infoWidgets.test.ts from prop-shape checks to visible-output behavior assertions
  • retained existing factory, drawlist, and app-level resilience tests that still protect distinct lower-level or broader contracts

Implementation bugs fixed

  • none

Validation

  • ./node_modules/.bin/tsc -b packages/core/tsconfig.json --pretty false
  • node --test packages/core/dist/widgets/__tests__/infoWidgets.test.js packages/core/dist/widgets/__tests__/basicWidgets.render.test.js packages/core/dist/app/__tests__/resilience.test.js

Explicit gaps left out

  • exact centering, truncation, and border geometry remain renderer details rather than public widget contracts
  • callout default icon and tone mapping remain intentionally unclaimed
  • errorBoundary recovery behavior stays covered by the existing app-level resilience suite rather than this widget-render slice

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for info widget components to verify rendered output and visible behavior (including titles, descriptions, icons, and action affordances) rather than internal implementation details.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@RtlZeroMemory has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 5 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 5 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55a63a0c-d5b2-459a-90b0-100571628e71

📥 Commits

Reviewing files that changed from the base of the PR and between 4584ce5 and 7ef8fba.

📒 Files selected for processing (1)
  • packages/core/src/widgets/__tests__/infoWidgets.test.ts
📝 Walkthrough

Walkthrough

Test file refactored to shift assertion methodology from structural VNode property checks to integration-style assertions validating rendered text output. Three widget test suites updated: ui.empty, ui.errorDisplay, and ui.callout, now verify user-visible behavior rather than internal implementation details.

Changes

Cohort / File(s) Summary
Widget Test Refactoring
packages/core/src/widgets/__tests__/infoWidgets.test.ts
Replaced VNode structure assertions with rendered text output assertions. Updated ui.empty, ui.errorDisplay, and ui.callout test coverage to validate visible behavior including icons, text content, and conditional rendering rather than prop preservation and callbacks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Tests once checked the props inside,
Now they peek at what's applied!
From structure deep to sight so true,
Better validation shines right through.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'testing: cover feedback widget behavior' directly and clearly relates to the main change: rewriting tests to assert visible behavior of feedback widgets (empty, errorDisplay, callout).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/testing-feedback-widget-behavior

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/core/src/widgets/__tests__/infoWidgets.test.ts (2)

21-32: Loosen exact-output assertions to avoid brittle failures.

Line 31 and Lines 63-68 currently assert exact full output shape. That can fail on harmless rendering/layout text changes unrelated to the behavior under test. Prefer presence/absence checks for contract-relevant strings only.

Suggested refactor
-    assert.equal(output.trim(), "[Retry]");
+    assert.equal(output.includes("[Retry]"), true);
-    const visibleLines = output
-      .split("\n")
-      .map((line) => line.trim())
-      .filter((line) => line.length > 0);
-
-    assert.deepEqual(visibleLines, ["✗ Oops", "boom"]);
+    assert.equal(output.includes("✗ Oops"), true);
+    assert.equal(output.includes("boom"), true);
+    assert.equal(output.includes("line1"), false);
+    assert.equal(output.includes("line2"), false);

Also applies to: 63-68

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/widgets/__tests__/infoWidgets.test.ts` around lines 21 -
32, The test currently uses an exact equality assertion on the full rendered
output (using createTestRenderer().render(ui.empty(...)).toText() and
assert.equal(output.trim(), "[Retry]") ), which is brittle; instead change the
assertion to check only the contract-relevant substring(s) (e.g. assert that
output includes "[Retry]" or that it contains the action label and/or absence of
title/description) so layout/whitespace changes won't break the test; update
this test and the similar assertions around the other case (the assertions at
lines 63-68) to use inclusion/regex/containment checks (e.g.
assert.include/assert.match/assert.ok(output.includes(...))) against
output.trim() rather than exact equality.

7-7: Add at least one multi-viewport pass for responsive confidence.

All cases render only at 40x10. Consider running these assertions across a second viewport (for example 80x24) to catch wrapping/truncation regressions.

As per coding guidelines, **/*.test.{ts,tsx} should “Test responsive behavior by validating UI at multiple viewport sizes.”

Also applies to: 22-22, 35-35, 54-54, 72-72

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/widgets/__tests__/infoWidgets.test.ts` at line 7, Current
tests only render via createTestRenderer({ viewport: { cols: 40, rows: 10 } }),
so add a second viewport run (e.g., { cols: 80, rows: 24 }) and assert the same
expectations to catch wrapping/truncation; refactor the test(s) to iterate over
an array of viewports (using createTestRenderer for each) and run the existing
assertions/snapshots inside that loop for the test cases in infoWidgets.test.ts
(referencing the existing createTestRenderer usage and the specific test blocks
around lines where assertions are made) so each case validates both small and
larger viewports.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/core/src/widgets/__tests__/infoWidgets.test.ts`:
- Around line 21-32: The test currently uses an exact equality assertion on the
full rendered output (using createTestRenderer().render(ui.empty(...)).toText()
and assert.equal(output.trim(), "[Retry]") ), which is brittle; instead change
the assertion to check only the contract-relevant substring(s) (e.g. assert that
output includes "[Retry]" or that it contains the action label and/or absence of
title/description) so layout/whitespace changes won't break the test; update
this test and the similar assertions around the other case (the assertions at
lines 63-68) to use inclusion/regex/containment checks (e.g.
assert.include/assert.match/assert.ok(output.includes(...))) against
output.trim() rather than exact equality.
- Line 7: Current tests only render via createTestRenderer({ viewport: { cols:
40, rows: 10 } }), so add a second viewport run (e.g., { cols: 80, rows: 24 })
and assert the same expectations to catch wrapping/truncation; refactor the
test(s) to iterate over an array of viewports (using createTestRenderer for
each) and run the existing assertions/snapshots inside that loop for the test
cases in infoWidgets.test.ts (referencing the existing createTestRenderer usage
and the specific test blocks around lines where assertions are made) so each
case validates both small and larger viewports.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5ddadf5-6eb3-4b0c-8ba2-54280c3cbe34

📥 Commits

Reviewing files that changed from the base of the PR and between 9df8069 and 4584ce5.

📒 Files selected for processing (1)
  • packages/core/src/widgets/__tests__/infoWidgets.test.ts

@RtlZeroMemory RtlZeroMemory force-pushed the feature/testing-feedback-widget-behavior branch from 4584ce5 to 7ef8fba Compare April 15, 2026 07:04
@RtlZeroMemory RtlZeroMemory merged commit 865f64c into main Apr 15, 2026
16 checks passed
@RtlZeroMemory RtlZeroMemory deleted the feature/testing-feedback-widget-behavior branch April 15, 2026 07:12
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.

1 participant