react-native-testing
/react-native-testing
Test React Native components with Jest and React Native Testing Library. Use when writing Jest or React Native Testing Library tests for React Native components.
- Author
- HoangNguyen0403 ↗
- Repository
- agent-skills-standard ↗
- Licence
- MIT
- Last repository change
- 22.10.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Test React Native components with Jest and React Native Testing Library. Use when writing Jest or React Native Testing Library tests for React Native components.
Original author description
Test React Native components with Jest and React Native Testing Library. Use when writing Jest or React Native Testing Library tests for React Native components.
How it works
- Priority: P1 (HIGH)
- Core Rule Anchors
- Setup & Component Testing
- Best Practices
- Anti-Patterns
- References
- Canonical response anchors
SKILL.md preview
---
name: react-native-testing
description: Test React Native components with Jest and React Native Testing Library. Use when writing Jest or React Native Testing Library tests for React Native components.
metadata:
triggers:
files:
- '**/*.test.tsx'
- '**/*.spec.tsx'
- '__tests__/**'
keywords:
- test
- testing
- jest
- render
- fireEvent
- waitFor
---
# React Native Testing
## **Priority: P1 (HIGH)**
## Core Rule Anchors
- **`[MOB-TEST-01]` Tripartite Naming**: Follow `Method_Scenario_ExpectedBehavior`.
- **`[MOB-TEST-02]` State & Component Invariant Rule**: Assert on visible user outcomes and accessible UI elements; never inspect component internal state or props directly.
- **`[MOB-TEST-03]` Entity Invariant Rule**: Test calculations, validations, and domain invariants; ban trivial echo assertions.
- **`[MOB-TEST-04]` Contract Testing Rule**: Intercept network requests at HTTP boundary (MSW) or native module boundary; ban 1:1 pass-through mock echoing without contract assertions.
- **`[MOB-TEST-05]` Bug-First Regression Lock**: Every PR resolving a bug ticket or with title `fix(...)` must introduce a test reproducing the defect prior to the fix.
## Setup & Component Testing
- **Jest & RNTL**: Use `@testing-library/react-native` for user-centric tests. Mock native modules with `jest.mock()`.
- **Component Example**:
```tsx
test('increments counter on button press', () => {
const { getByText, getByRole } = render(<Counter />);
fireEvent.press(getByRole('button', { name: /increment/i }));
expect(getByText('Count: 1')).toBeTruthy();
});
```
## Best Practices
- **User-Centric**: Use `getByRole`, `getByText` over `testID`. Use `findBy*` for async elements.
- **Integration > Unit**: Test features, not implementation. Avoid brittle snapshots.
- **Coverage**: Coverage is diagnostic and project-configured; verify risk-weighted critical paths rather than padding code for an arbitrary percentage.
## Anti-Patterns
- **No Testing Implementation**: Test behavior, not internals. Avoid `testID` overuse.
- **Banned Smells**: Ban vague names, inspecting component state/props, echo assertions, and pass-through mocks.
## References
See [references/testing-library.md](references/testing-library.md) for RNTL setup, mocking providers, and integration flow examples.
## Canonical response anchors
When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- Integration
- RNTL
- Additional task-grounded exact anchors: test behavior
Files in this package (3)
- SKILL.md 3 KB
- evals/evals.json 3 KB
- references/testing-library.md 2 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · HoangNguyen0403/agent-skills-standard | 100 | MIT |
| callstack/react-native-testing-library | 100 | MIT |
| jyotiraditya-chauhan/test-kit | 100 | MIT |
Database snapshot: 13.11.2026 · package version 5cb9510f7aff (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100react-testing
Test React components with RTL and Jest/Vitest. Use when writing React component tests with React Testing Library, Jest, or Vitest. - 100react-native-web-testing
Use when testing React Native Web applications. Provides patterns for Jest, React Native Testing Library, component testing, and web-specific testing strategies. - 100react-native-components
Build modern React Native components using function components and composition. Use when building or refactoring React Native function components and composable UI. - 100rn-testing
Testing React Native: Jest with jest-expo / react-native preset, React Testing Library Native, native module mocking, hook testing. Optional sections for Detox (native automation) and Maestro (declarative YAML e2e). Use this skill to: - Configure Jest preset based on workflow. -… - 100create-react-native-library
Scaffolds React Native libraries with create-react-native-library for standalone libraries or local native modules and views. Use when creating or working on React Native libraries or adding native functionality in an existing app. - 100testing-react
Writes React/TypeScript tests using Vitest and React Testing Library. Use when "write react tests", "vitest", "component test", "hook test", "RTL", "testing library", "snapshot test", or testing React components, hooks, and utilities.