test(map): cover cluster→task navigation guard in MapScreen - #156
Merged
cybermax4200 merged 1 commit intoAug 29, 2026
Merged
Conversation
Extend MapScreen.test.tsx with the cluster-expansion interaction that was previously untested: a multi-task cluster callout must NOT navigate (guard `if (!isCluster && firstTask)`), while a count:null promoted single-task marker must navigate to TaskDetail with the correct taskId. The existing single-marker navigation test is retained. Closes ecotask-network#147
cybermax4200
approved these changes
Aug 29, 2026
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #147
MapScreenrenders markers and cluster markers, but the most user-critical map interaction — tapping a marker/callout to reach a task — was only partially tested.MapScreen.test.tsxalready covered single-task marker navigation, yet the cluster guard behavior was unverified:This extends the existing file with the missing guard tests, using the
Markermock that exposesonCalloutPresson its component instance.What's covered (new tests)
navigateis never called — verifying theif (!isCluster && firstTask)guard prevents navigation for multi-task clusters (the "tap a cluster, nothing happens because zoom isn't supported here" path).TaskDetailwith the correcttaskId.The existing
MapScreenPerformance.test.tsxcontinues to benchmark clustering only; correctness of the expansion path now lives here.Approach
react-native-mapssoMarkeris a plainView,useTaskFeed,useLocation, and@react-navigation/native(assertingnavigate('TaskDetail', { taskId })).onCalloutPressdirectly on theMarkertest instance, which exercises the real guard inhandleCalloutPress/MapScreen.tsx:250-254.clusterTasksproduces the exact mix of multi-task cluster + promoted single marker needed to hit both branches.Verification
npm test→ 416/416 passing (45 suites); theMapScreensuite is 10/10.npm run typecheck(tsc --noEmit) → clean.npm run lint→ 0 errors on the file.Out of scope
Zoom-to-expand gesture behavior (platform-native, untestable in Jest) and a cluster bottom-sheet (separate UX issue).