reactut
Installation
SKILL.md
React Native Unit Testing Guidelines
This document outlines the standards and best practices for writing unit tests in this React Native project. Our testing strategy is centered around React Native Testing Library, which encourages testing application behavior from a user's perspective.
Core Principles
All tests should adhere to the following principles:
- The Golden Rule: Test your components' behavior, not their implementation details. The more your tests resemble the way your software is used, the more confidence they can give you.
- A.A.A. (Arrange, Act, Assert): Structure your tests clearly.
- Arrange: Set up the test conditions, including rendering the component with the necessary props and mocks.
- Act: Interact with the component (e.g., press a button, type in a field).
- Assert: Verify that the expected outcome has occurred.
- F.I.R.S.T:
- Fast: Tests should run quickly.
- Independent: Tests should not depend on each other.
- Repeatable: Tests should produce the same results every time.
- Self-Validating: Tests should have a clear pass or fail outcome.
- Timely: Tests should be written alongside the feature code.