Mobile has had no way to behavior-test a React Native component: importing
react-native hard-fails the transform in the node test runner, so the
component-shaped tests that exist render to static markup through ad hoc
react-native mocks and assert on attributes, which AGENTS.md prohibits.
Adds the pieces that pattern needs, mirroring the web app's established
react-test-renderer approach so both apps test components the same way:
- src/testing/react-native-test-host: a vi.mock("react-native") replacement
whose primitives render as named host elements; Pressable honors disabled,
Linking records opened urls. Kept minimal on purpose.
- src/testing/reanimated-test-host: inert shared values and transitions for
modules that import react-native-reanimated.
- src/testing/test-host-elements.d.ts: the host-element vocabulary for
typecheck.
- QuestionAnswerHistory.test.tsx: replaces the prohibited static-markup test
with behavior tests (press opens the resolved url, presses are ignored
while unresolved, resolving the url mounts the preview and re-arms the
press through a real re-render).
- ThreadReasoningRow.test.tsx: proves the approach on high-churn code -
thread-work-log.tsx changes almost daily and this covers its
expand/collapse mount gating and toggle wiring, which static markup
cannot reach.
react-test-renderer is pinned to 19.2.3 to peer-match the mobile react pin
exactly; a drift would install a second react inside the renderer and
silently break hooks identity.
Model: callstack/Apex via pi
Co-authored-by: Apex by Callstack <noreply@callstack.com>Julius Marminge committed on 9/22/2026, 11:10:21 PMparentd7819c1
7 files changedLine totals unavailable