Skip to content
Back to skills

React Native Testing

ASecurity

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.

  • 549 stars
  • 0 votes
  • 1 copy
  • 9 views
  • Added June 6, 2026
developmentreacttesting

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 3, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill react-native-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Native Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Native Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-react-native-testing/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-react-native-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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 skill

  • SKILL.md1.7 KB
  • evals/evals.json2 KB
  • references/testing-library.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.