testing: cover tool approval dialog surface#382
Conversation
📝 WalkthroughWalkthroughTwo test files expanded with coverage for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
🧹 Nitpick comments (1)
packages/core/src/widgets/__tests__/overlays.test.ts (1)
125-194: Add a narrow-viewport variant for these render-surface assertions.The new open/closed and optional-action checks are solid, but they only run at
60x16. Adding at least one smaller viewport case would better protect responsive truncation/wrapping behavior for the approval surface.As per coding guidelines, "Test responsive behavior by validating UI at multiple viewport sizes."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/widgets/__tests__/overlays.test.ts` around lines 125 - 194, Add narrow-viewport variants of the existing toolApprovalDialog tests by re-running the same assertions using createTestRenderer with a smaller viewport (e.g., cols: 40, rows: 10) to validate responsive truncation/wrapping; replicate the three cases that reference ui.toolApprovalDialog (open with full request including command, open without onAllowForSession, and closed) and assert the same key strings (e.g., "Tool Approval", "Tool: Shell", "Risk: HIGH"/"Risk: LOW", "Command:" and "rm -rf /tmp/demo" where applicable, "[Allow]", "[Deny]", and absence/presence of "[Allow Session]") and that closed dialog returns an empty trimmed string, using the same helper createTestRenderer and test names for easy discovery.
🤖 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__/overlays.test.ts`:
- Around line 125-194: Add narrow-viewport variants of the existing
toolApprovalDialog tests by re-running the same assertions using
createTestRenderer with a smaller viewport (e.g., cols: 40, rows: 10) to
validate responsive truncation/wrapping; replicate the three cases that
reference ui.toolApprovalDialog (open with full request including command, open
without onAllowForSession, and closed) and assert the same key strings (e.g.,
"Tool Approval", "Tool: Shell", "Risk: HIGH"/"Risk: LOW", "Command:" and "rm -rf
/tmp/demo" where applicable, "[Allow]", "[Deny]", and absence/presence of
"[Allow Session]") and that closed dialog returns an empty trimmed string, using
the same helper createTestRenderer and test names for easy discovery.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: bd027321-54ce-4118-a826-a90f25e73acc
📒 Files selected for processing (2)
packages/core/src/widgets/__tests__/overlay.edge.test.tspackages/core/src/widgets/__tests__/overlays.test.ts
Summary
Families and systems covered
Tests added, rewritten, removed
packages/core/src/widgets/__tests__/overlays.test.tspackages/core/src/widgets/__tests__/overlay.edge.test.tsImplementation bugs fixed
Validation
./node_modules/.bin/tsc -b packages/core/tsconfig.json --pretty falsenode --test packages/core/dist/widgets/__tests__/overlays.test.js packages/core/dist/widgets/__tests__/overlay.edge.test.js packages/core/dist/widgets/__tests__/widgetRenderSmoke.test.jsExplicit gaps left out
Summary by CodeRabbit