React Nativeは複数のレベルでのテストをサポートしています — ユニットテスト(ロジック)、コンポーネントテスト(React Native Testing Libraryを使用)、およびエンドツーエンドテスト(Detoxを使用)。優れたテスト戦略は信頼性と確信度を向上させます。
ユニットテストとコンポーネントテスト(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.()).();
});
