# test\(mobile\): give component tests a real renderer and a react-native test host · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/889399209dc91ad320b147915aec1dd68c52e444)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: 889399209dc91ad320b147915aec1dd68c52e444

Requested commit: 889399209dc91ad320b147915aec1dd68c52e444

Commit: 889399209dc91ad320b147915aec1dd68c52e444

Tree: 8c938c6685e0d02dcf2cfe3e97e6841f51e88f74

Author: Julius Marminge

Committer: Julius Marminge

## Message

```
test(mobile): give component tests a real renderer and a react-native test host

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>

```

## Parents

- [d7819c18813fa03b033cc1c9472c9acc0ffc0618](https://git.cafe/pingdotgg/t3code/commit/d7819c18813fa03b033cc1c9472c9acc0ffc0618?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/889399209dc91ad320b147915aec1dd68c52e444?format=markdown)
