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…
by HoangNguyen0403★ 598 GitHub stars
Install react-native-testing in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
React Native Testing
Priority: P1 (HIGH)
Core Rule Anchors
[MOB-TEST-01]Tripartite Naming: FollowMethod_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 titlefix(...)must introduce a test reproducing the defect prior to the fix.[MOB-TEST-06]Layer & Device Fidelity: Unit/Component (Jest + RNTL) vs Native E2E (Detox / Appium / Maestro). RNTL verifies in-memory components; it never substitutes for native device verification.
Setup & Component Testing
- Jest & RNTL: Use
@testing-library/react-nativefor user-centric tests. Mock native modules withjest.mock(). - Component Example:
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,getByTextfor accessibility-first queries; keeptestIDfor automation andaccessibilityLabelfor screen readers. UsefindBy*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
testIDoveruse. - Banned Smells: Ban vague names, inspecting component state/props, echo assertions, and pass-through mocks.
References
- RNTL Setup & Integration Reference
- Mobile Testing Methodology — 10 mobile scope areas & C6 contract
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- evals/evals.json
- references/testing-library.md
FAQ
What does the react-native-testing skill do?
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 do I install the react-native-testing skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the react-native-testing skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…