React Native podpira testiranje na več nivojih — enojne teste (logika), teste komponent (s React Native Testing Library) in teste od konca do konca (s Detox). Dobra strategija testiranja izboljša zanesljivost in zaupanje.
Testiranje enot in komponent (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.()).();
});
