React Native Test Suite

React native testing

by HoangNguyen0403 · MIT license · ★ 569 on GitHub

React native testing cover

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.

---
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

Overview

See references/testing-library.md for RNTL setup, mocking providers, and integration flow examples.

Manual install (npx, ZIP)
Claude Codenpx skills add HoangNguyen0403/agent-skills-standard --skill react-native-testing -g -a claude-code
Claude Code (degit)npx degit HoangNguyen0403/agent-skills-standard/skills/react-native/react-native-testing#develop ~/.claude/skills/react-native-testing
Claude.ai / desktopZip the folder and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md2.5 KB
Read SKILL.md here
HoangNguyen0403/develop1 file shown
SKILL.md
Show the full text63 lines

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:
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 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

1---
2name: react-native-testing
3description: 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.
4metadata:
5 triggers:
6 files:
7 - '**/*.test.tsx'
8 - '**/*.spec.tsx'
9 - '__tests__/**'
10 keywords:
11 - test
12 - testing
13 - jest
14 - render
15 - fireEvent
16 - waitFor
17---
18# React Native Testing
19 
20## **Priority: P1 (HIGH)**
21 
22## Core Rule Anchors
23 
24- **`[MOB-TEST-01]` Tripartite Naming**: Follow `Method_Scenario_ExpectedBehavior`.
25- **`[MOB-TEST-02]` State & Component Invariant Rule**: Assert on visible user outcomes and accessible UI elements; never inspect component internal state or props directly.
26- **`[MOB-TEST-03]` Entity Invariant Rule**: Test calculations, validations, and domain invariants; ban trivial echo assertions.
27- **`[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.
28- **`[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.
29 
30## Setup & Component Testing
31 
32- **Jest & RNTL**: Use `@testing-library/react-native` for user-centric tests. Mock native modules with `jest.mock()`.
33- **Component Example**:
34```tsx
35test('increments counter on button press', () => {
36 const { getByText, getByRole } = render(<Counter />);
37 fireEvent.press(getByRole('button', { name: /increment/i }));
38 expect(getByText('Count: 1')).toBeTruthy();
39});
40```
41 
42## Best Practices
43 
44- **User-Centric**: Use `getByRole`, `getByText` over `testID`. Use `findBy*` for async elements.
45- **Integration > Unit**: Test features, not implementation. Avoid brittle snapshots.
46- **Coverage**: Coverage is diagnostic and project-configured; verify risk-weighted critical paths rather than padding code for an arbitrary percentage.
47 
48## Anti-Patterns
49 
50- **No Testing Implementation**: Test behavior, not internals. Avoid `testID` overuse.
51- **Banned Smells**: Ban vague names, inspecting component state/props, echo assertions, and pass-through mocks.
52 
53## References
54 
55See [references/testing-library.md](references/testing-library.md) for RNTL setup, mocking providers, and integration flow examples.
56 
57## Canonical response anchors
58 
59When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
60- Integration
61- RNTL
62 
63- Additional task-grounded exact anchors: test behavior
View all files on GitHub →

Details

License
MIT
Stars on the repo
★ 569
Checked
Source
HoangNguyen0403/agent-skills-standard ↗
Creator
HoangNguyen0403 · 21 listings
View creator

Similar skills

See all →
SkillExpo Task Routerexpo/skills · by expoEntry point and router for every Expo or EAS task. Load this skill first — before writing code and before choosing another expo-* / eas-* skill — when the request, PRD, or spec mentions Expo, EAS, Expo Go, or an expo-* package, or the project has an `expo` dependency in `package.json`. Within that gate it also covers app specs and designs to implement (tabs, stacks, maps, lists, navigation, building from a screenshot), and phrasings like 'implement a mobile app', 'make my app look native', 'add navigation', 'fetch some data', 'upgrade my SDK', 'add Expo to my existing native app', 'ship to the App Store', or 'I'm new to Expo, where do I start'. A fully specified request (SDK pinned, libraries named, layout given) still routes through here — the shared setup rules still apply. Do NOT load it when neither signal is present: a bare React Native project with no `expo` dependency is not Expo work. Detects the real goal, routes to the right expo-* / eas-* skill, and owns the shared setup rules.★ 2.7k GitHub starsSkilliOS App Clip Setupexpo/skills · by expoAdd an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.★ 2.7k GitHub starsSkillApp Store Deploy Agentexpo/skills · by expoBuild and submit iOS and Android apps with EAS to TestFlight, the App Store, or Google Play. Supports Expo and other React Native projects, plus existing native apps. Use for eas.json setup, release pipelines, signing, app versions and build numbers, store submissions, and listing metadata. For Expo websites and API routes, use eas-hosting; for adding React Native screens to a native app, use expo-brownfield.★ 2.7k GitHub starsSkillSleek Mobile App Designersleekdotdesign/agent-skills · by sleekdotdesignUse when the user wants to design a mobile app or UI screens, when they mention their Sleek (sleek.design) projects, or when implementing Sleek designs in code (HTML, React Native, SwiftUI).★ 583 GitHub starsSkillReact Native Animation Builderemilkowalski/skills · by emilkowalskiBuild animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use `animate`.★ 40.8k GitHub starsSkillModern Swift Writing Guideemilkowalski/skills · by emilkowalskiHow to write modern Swift well — modeling with value types, Swift 6 data-race safety and approachable concurrency (@concurrent, main-actor-by-default, actors, task groups), protocols and generics (some vs any), API design, performance and ARC, Swift Testing, macros, and the modern language features agents don't know about yet. Use when writing, reviewing, or migrating Swift, or when a concurrency error, a hang, a data race, a retain cycle, or a performance problem needs fixing.★ 40.8k GitHub stars

More from HoangNguyen0403

SkillAndroid Test WriterHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Write Android unit, Compose UI, and Hilt-integrated tests. Use when designing test behavior with MockK or coroutine test utilities; defer database/WorkManager-specific recipes to the owning feature skill.★ 569 GitHub starsSkillArchitecture Diagram DesignerHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Draws architecture diagrams as editable draw.io files with a fixed house style, C4 levels, evidence-tagged shapes, and optional multi-view identity checks. Use when producing a system context, container, component, deployment, data flow, sequence, state, or ERD, or redrawing an ASCII or Mermaid one.★ 569 GitHub starsSkillCode Review ExpertHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Conduct high-quality, persona-driven code reviews. Use when reviewing PRs, critiquing code quality, or analyzing changes for team feedback.★ 569 GitHub starsSkillCybersecurity Framework MapperHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Maintains sparse, reviewable cybersecurity framework edges with versioned IDs, relation, rationale, source, and review status. Use when mapping exercise observations or procedures to NIST, ATT&CK, or another named framework.★ 569 GitHub starsSkillDecision Discipline FrameworkHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Right-size, ground, and gate SDLC decisions with SNC-sized depth, said-vs-assumed write-back, an evidence ledger, honest option cards, recorded approval, and self-review. Use when running brainstorm-feature, plan-feature, design-solution, or system-design-session.★ 569 GitHub starsSkillFlutter Robot Pattern TestsHoangNguyen0403/agent-skills-standard · by HoangNguyen0403Write unit, widget, and integration tests with robot patterns, widget keys, and Patrol in Flutter. Use when implementing test behavior; defer CI-only configuration without test changes.★ 569 GitHub stars