test: NonScalingOverlay + ReactNativeZoomableView test suite (274 tests, 29 suites)#179
test: NonScalingOverlay + ReactNativeZoomableView test suite (274 tests, 29 suites)#179thomasttvo wants to merge 1 commit into
Conversation
PR SummaryLow Risk Overview Introduces supporting test infrastructure (Jest config/setup and gesture-handler/reanimated mocking) and extracts a few inline math/predicate helpers into Reviewed by Cursor Bugbot for commit 270d5fc. Configure here. |
|
Superseded by PR for thomas/zoomable-tests-v2 — original branch had merge-base issue making the diff empty in GitHub's view. Replacement PR rooted at b8a6df6 so the diff displays correctly. |
Summary
Adds a Jest + React Testing Library test suite covering NonScalingOverlay,
renderOverlayintegration, and the full SPECS.md contract forReactNativeZoomableView. 274 tests across 29 suites, all green locally.Targets
thomas/nonscaling-overlay(PR #178) — when #178 merges to master, this PR's base auto-updates and the tests come along.Test coverage
SPECS.md(with documented device-only and type-only gaps).Suite breakdown
computeOverlayTransform.test.tsNonScalingOverlay.test.tsxrenderOverlay.test.tsxhelper/__tests__/*(9 files)RNZV.{props,imperativeHandle,callbacks}.test.tsxRNZV.{staticPin,feedback}.test.tsx+useLatestWorklet.test.tstreeShape.test.tsx+StaticPin.styling.test.tsxgestures/*(5 files)getByGestureTestId('canvas-gesture')(tap, double-tap, long-press, pinch, shift, multi-finger, pan-responder callbacks, intercept)Test infrastructure (commit
e76d21f)@testing-library/react-native@^12.5.0,react-test-renderer@18.3.1,babel-jest,@types/jest.jest.setup.tswiresreact-native-reanimated/mock+react-native-gesture-handler/jestSetup.Gesture.Manual()mock with awithTestIdregistry (Path 2 from research) so gesture-driven tests can invokeonTouchesDown/Move/Up/Cancelleddirectly under reanimated/mock..github/workflows/lint.yml:yarn test --ci --runInBand.Pure-helper extractions (non-behavior-changing)
4 inline expressions in
ReactNativeZoomableView.tsxextracted tosrc/helper/for unit-testability — math is byte-equivalent to the inline original:calcShiftDelta(from_calcOffsetShiftSinceLastGestureState)applyPinchSensitivity(from_handlePinchingresistance math)clampZoom(pinch-frame clamp;publicZoomTo's reject-on-out-of-range was left untouched — different semantics)shouldSkipShift(pan-gate predicate)SPECS.md changes
## NonScalingOverlay contractcodifying the prop shape, 5-element transform formula, static-style rules, mount-order rules, andwrapperSizemirror semantics.Known gaps (documented in
phase5-specs-research.md§5)disablePanOnInitialZoom, native momentum absence, dual-version Reanimated matrix (Elliott's #3691782346).tsc --noEmitin CI (noexpect-type/tsddep added).withTiming/cancelAnimation/runOnUIare no-ops under the mock.Test plan
yarn testlocally and confirms 29 suites / 274 tests pass.Run unit testsstep passes on push.it('SPEC-NNN: …', …)cases to confirm SPEC IDs map to the items inSPECS.md.🤖 Generated with Claude Code