Repository navigation
test(mobile): stub BackHandler for the to-do list settings sheet - #8475
Conversation
The sheet adds a focus-scoped hardware Back listener, so its mounted suite's partial react-native mock must export BackHandler.
| vi.mock('react-native', async () => { | ||
| const { NativeTextInput } = await import('./todo-list-model-picker.mounted.test-helpers'); | ||
| return { | ||
| BackHandler: { addEventListener: () => ({ remove: () => undefined }) }, |
There was a problem hiding this comment.
SUGGESTION: Inert stub leaves the hardware-back path unexercised
The stub fixes the mock error, but it never records or invokes the registered handler, so the focus-scoped hardwareBackPress listener added in todo-list-settings-sheet.tsx:76 (register on focus, remove on blur) is now mounted but untested in this suite. tour-screen.mounted.test.tsx:26-58 models BackHandler as a live subscription set precisely so a test can press Back and assert which listeners are registered; adopting the same shape here would let a later test cover the guard without another mock change.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe test-only Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Reviewed by deepseek-flash-latest · Input: 43.1K · Output: 2.7K · Cached: 272.5K Review guidance: REVIEW.md from base branch |
Problem
mainCI is red:mobile-test (5/8)fails onsrc/components/todos/todo-list-model-picker.mounted.test.tsx.The to-do list settings sheet now installs a focus-scoped
hardwareBackPresslistener (#8249), but the mounted suite's partialreact-nativemock never exportedBackHandler. The merge queue inherits the same failure.Fix
Add
BackHandlerto the test'sreact-nativemock, the same stub the other guarded-sheet suites use:Test-only change.
Verification
pnpm vitest run src/components/todos/— 3 files, 8 tests pass (fails before the change with the error above).oxfmt --list-differentclean.