testing: rewrite widget coverage around expected behavior#366
testing: rewrite widget coverage around expected behavior#366RtlZeroMemory merged 3 commits intomainfrom
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR removes a legacy table render-cache test suite and introduces a comprehensive testing framework with new reference scenarios for select keyboard navigation and textarea multiline editing, alongside extensive contract tests covering widget interactions including focus management, modals, overlays, sorting, and tree expansion. Minor CI environment variable typing improvements are also applied. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 (2)
packages/node/src/__tests__/testingHarness.test.ts (1)
14-15: Type safety improvement for CI environment variable access.The explicit typing matches the pattern in
ptyScenario.test.tsand improves type safety for the CI environment check. The duplication across two test files is acceptable, though if this pattern appears in additional files, consider extracting it to a shared test utility.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/node/src/__tests__/testingHarness.test.ts` around lines 14 - 15, Replace the plain process.env access with a typed environment object to improve type safety: cast process.env to NodeJS.ProcessEnv & Readonly<{ CI?: string }> and use that typed variable when computing isMacOsCi (the symbols to change are env and isMacOsCi); follow the same pattern used in ptyScenario.test.ts so the CI check becomes process.platform === "darwin" && env.CI === "true".packages/core/src/app/__tests__/wave1.behavior.test.ts (1)
344-346: Hardcoded coordinates may be fragile.The click coordinates
(2, 3)assume a specific layout for the dropdown items. If the dropdown positioning or item rendering changes, this test could break silently or click the wrong item.Consider using
centerOf(renderer, "dd-item-two")or a similar approach if dropdown items expose IDs, or add a comment explaining the expected layout.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/app/__tests__/wave1.behavior.test.ts` around lines 344 - 346, The test uses hardcoded coordinates in renderer.routeEngineEvent(mouseEvent(...)) which is fragile; replace the literal (2,3) coords with a computed target (e.g., const target = centerOf(renderer, "dd-item-two") or another helper that resolves the dropdown item's center) and pass target.x/target.y into mouseEvent, then call renderer.routeEngineEvent(mouseEvent(...)) and submit(renderer, view) as before so the click targets the correct dropdown item regardless of layout changes.
🤖 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/app/__tests__/wave1.behavior.test.ts`:
- Around line 344-346: The test uses hardcoded coordinates in
renderer.routeEngineEvent(mouseEvent(...)) which is fragile; replace the literal
(2,3) coords with a computed target (e.g., const target = centerOf(renderer,
"dd-item-two") or another helper that resolves the dropdown item's center) and
pass target.x/target.y into mouseEvent, then call
renderer.routeEngineEvent(mouseEvent(...)) and submit(renderer, view) as before
so the click targets the correct dropdown item regardless of layout changes.
In `@packages/node/src/__tests__/testingHarness.test.ts`:
- Around line 14-15: Replace the plain process.env access with a typed
environment object to improve type safety: cast process.env to NodeJS.ProcessEnv
& Readonly<{ CI?: string }> and use that typed variable when computing isMacOsCi
(the symbols to change are env and isMacOsCi); follow the same pattern used in
ptyScenario.test.ts so the CI check becomes process.platform === "darwin" &&
env.CI === "true".
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a99a1873-0846-4289-ab65-24a1e01869e6
📒 Files selected for processing (8)
packages/core/src/app/__tests__/table.renderCache.test.tspackages/core/src/app/__tests__/wave1.behavior.test.tspackages/core/src/testing/__tests__/wave1ScenarioHarness.test.tspackages/core/src/testing/index.tspackages/core/src/testing/referenceScenarios/selectKeyboardCycler.tspackages/core/src/testing/referenceScenarios/textareaMultilineEditing.tspackages/node/src/__tests__/ptyScenario.test.tspackages/node/src/__tests__/testingHarness.test.ts
💤 Files with no reviewable changes (1)
- packages/core/src/app/tests/table.renderCache.test.ts
Scope
Areas Touched
Old Tests Removed Or Merged
packages/core/src/app/__tests__/table.renderCache.test.tsbecause it only asserted cache identity/reuse and did not protect visible table behaviorinputEditor.*,focus.layers.test.ts,overlayUnification.test.ts,dropdown.position.test.ts,table.*,virtualList.*, andtree.*where they still protect deterministic lower-level contracts not replaced by the new behavior oraclesNew Behavior Oracles Introduced
returnFocusTofocus restoreTest Commands Run
npm install./node_modules/.bin/biome check packages/core/src/app/__tests__/widgetBehavior.contracts.test.ts packages/core/src/testing/__tests__/referenceScenario.semantic.test.ts./node_modules/.bin/tsc -b packages/core/tsconfig.json packages/node/tsconfig.json --pretty falsenpm -w @rezi-ui/native run build:nativenode --test packages/core/dist/app/__tests__/widgetBehavior.contracts.test.js packages/core/dist/testing/__tests__/referenceScenario.semantic.test.js packages/core/dist/testing/__tests__/scenarioHarness.test.js packages/node/dist/__tests__/testingHarness.test.js packages/node/dist/__tests__/ptyScenario.test.jsKnown Unresolved Areas Left For Later
Summary by CodeRabbit
Tests
Chores