Repository navigation
test(floating-terminal): mock the bulk-close confirmation the panel suite cannot render - #30568
Conversation
…uite cannot render #30551 routed bulk tab closes through useConfirmationDialog, whose real useContext has no dispatcher when this suite calls the panel as a plain function. All 73 behavior cases failed on main. Confirm immediately in the mock so the bulk-close assertions still run right after the click.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
ELI5
After #30551 ("Confirm before bulk-closing tabs") merged, all 73 cases in
FloatingTerminalPanel.behavior.test.tsxfail on main withTypeError: null is not an object (evaluating 'dispatcher.useContext'). That breaks thetest / tests node 24 3/5shard for every PR. This test-only fix makes the suite pass again.What Changed
FloatingTerminalPanelas a plain function, with React's hooks swapped for test versions. Confirm before bulk-closing tabs #30551 made bulk closes go throughuseBulkTabCloseConfirmationand thenuseConfirmationDialog, which calls the realuseContext. Outside a React render there's nothing to back that call, so every case crashed.@/components/use-bulk-tab-close-confirmationwith a version that confirms at once, so the bulk-close assertions still run right after the click. The real hook keeps its own coverage from Confirm before bulk-closing tabs #30551.Why
confirmation-dialog-contextwith an async confirm leaves 5 bulk-close cases failing, because they assert synchronously.unicorn/no-thenable.Linked Issue
N/A (maintainer). Unblocks PR CI for everyone.
Visual Proof
N/A: test-only.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
src/renderer/src/components/floating-terminal/: 11 files, 150 tests pass. Before the fix, the behavior file had 73 failures.bun check -p config/tsconfig.tc.web.jsonpasses, as do oxlint and the changed-code quality gate.Review
Agent skill upstream boundary
Notes
Test-only.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)