React Native suportă testarea la mai multe niveluri — teste unitare (logică), teste de componente (cu React Native Testing Library) și teste end-to-end (cu Detox). O strategie bună de testare îmbunătățește fiabilitatea și încrederea.
Testare unitară și de componente (Jest + Testing Library)
JEST → the standard JS test runner (unit tests for logic, functions, hooks)
REACT NATIVE TESTING LIBRARY → test components by rendering and interacting with them
(the way a user would) — query elements, fire events, assert on output
{ render, fireEvent, screen } ;
(, {
();
fireEvent.(screen.());
(screen.()).();
});
