-
Notifications
You must be signed in to change notification settings - Fork 63
test: NonScalingOverlay + ReactNativeZoomableView test suite (274 tests, 29 suites) #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: thomas/nonscaling-overlay
Are you sure you want to change the base?
Changes from all commits
f7ede69
dccd1f8
1062eb4
df86fbc
2a13abc
3ea1c10
bebae3c
0129282
2214a41
8fa390d
1bcde4f
a39d719
465e8a1
48f2fa2
fb71f67
dd2672e
7af33be
477d2e3
fb798ea
a08c807
e145ed8
61869de
3ad9261
020ba07
bb8533b
92427fa
26c2205
3445157
93a8874
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,5 @@ jobs: | |
| run: yarn run lint | ||
| - name: Build | ||
| run: yarn build | ||
| - name: Run unit tests | ||
| run: yarn test --ci --runInBand | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| module.exports = { | ||
| presets: ['module:@react-native/babel-preset'], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import 'react-native-gesture-handler/jestSetup'; | ||
|
|
||
| // Reanimated 3 ships an official mock that runs animated styles synchronously. | ||
| jest.mock('react-native-reanimated', () => { | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return | ||
| return require('react-native-reanimated/mock'); | ||
| }); | ||
|
|
||
| // Stub RN's renderer shim so importing RNGH's utils.js doesn't crash on | ||
| // `ReactNativeRenderer-dev` evaluation. RNGH's `useViewRefHandler` calls | ||
| // `findNodeHandle(ref)` via `RendererImplementation.js`, which lazily | ||
| // requires `ReactNativeRenderer-dev.js` and crashes under jest with | ||
| // `Cannot read properties of undefined (reading 'S')` (the documented | ||
| // Phase A §7a crash). We hand back a stable fake nodeHandle (42) — the | ||
| // gesture isn't attached to a real native view, but `attachHandlers` | ||
| // still completes and registers the testID. This mock is additive: it | ||
| // only intercepts a render path that tests don't otherwise reach. | ||
| // Hoisted here per phase E probe §6.1 so real-RNGH tests across the | ||
| // suite inherit it without per-file repetition. | ||
| jest.mock( | ||
| 'react-native/Libraries/Renderer/shims/ReactNative', | ||
| () => ({ | ||
| __esModule: true, | ||
| default: { | ||
| findHostInstance_DEPRECATED: (ref: unknown) => ref, | ||
| findNodeHandle: () => 42, | ||
| render: () => null, | ||
| unmountComponentAtNodeAndRemoveContainer: () => null, | ||
| unstable_batchedUpdates: (fn: () => void) => { | ||
| fn(); | ||
| }, | ||
| dispatchCommand: () => null, | ||
| sendAccessibilityEvent: () => null, | ||
| isChildPublicInstance: () => false, | ||
| }, | ||
| }), | ||
| { virtual: false } | ||
| ); | ||
|
|
||
| // Reanimated mock recommends silencing the layout-animation warning. | ||
| // (See https://docs.swmansion.com/react-native-reanimated/docs/guides/testing/) | ||
| jest.spyOn(global.console, 'warn').mockImplementation((msg: unknown) => { | ||
| if (typeof msg === 'string' && msg.includes('Reanimated 2')) return; | ||
| // fall through other warnings | ||
| }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jest.setup suppresses all console.warn, not just ReanimatedMedium Severity The Reviewed by Cursor Bugbot for commit dd2672e. Configure here. |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPECS.md documents internal implementation details for NonScalingOverlay
Low Severity
The NonScalingOverlay contract section includes implementation details that violate the SPECS.md authoring rules. Specifically: the "Transform formula" subsection documents the exact 5-element transform array structure with index positions (
transform[3..4]), the "Mounting rules" subsection references internal tree topology relative toGestureDetector, and source ordering withinReactNativeZoomableView. These are implementation internals, not consumer-observable behavior.Triggered by learned rule: SPECS.md must document consumer-observable behavior only
Reviewed by Cursor Bugbot for commit dd2672e. Configure here.