Agent skill · software engineering · aiskillstore

rn-testing

Testing patterns for React Native with Jest and React Native Testing Library. Use when writing tests, mocking Expo modules, testing Zustand stores, or debugging test failures.

Why this skill is useful

Provides specific testing patterns and mocking strategies for Zustand and Expo modules that the AI wouldn't reliably generate on its own.

What it needs

Requires @testing-library/react-native, jest installed locally. About 5k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

React Native Testing Problem Statement React Native testing requires extensive mocking of native modules, careful handling of async operations, and understanding of Zustand store testing patterns. This codebase has 30+ test files with established patterns. --- Pattern: Zustand Store Testing Problem: Store state persists between tests, causing flaky tests. Key points: Use setState(initialState, true) to replace (not merge) state Get fresh state with getState() after async operations Don't rely on component re-renders in store tests --- Pattern: Async Store Operations Problem: Testing async Zustand actions with proper waiting. --- Pattern: Expo Module Mocking Problem: Expo modules require mocks for Jest. Check jest.setup.js - many mocks are already configured globally. --- Pattern: React Query Testing Problem: Components using React Query need QueryClientProvider. --- Pattern: Custom Hook Testing --- Pattern: Component Testing --- Pattern: Navigation Testing --- Pattern: Avoiding act() Warnings Problem: "Warning: An update inside a test was not wrapped in act(...)" --- Pattern: Snapshot Testing When to use: UI components with stable structure Design system components Components where visual regression matters When to avoid: Components with dynamic content Components that change frequently Large component trees (brittle) --- Pattern: Mocking API Calls --- Recommended Test Utilities Test Commands --- Common Issues Issue Solution ------- ---------- "Cannot find module" Check jest.setup.js module mappings act() warning Wrap state updates in act(), use waitFor/findBy Store state bleeding Add beforeEach with setState reset Async test timeout Increase timeout or check for hanging promises Mock not working Verify mock path matches import path exactly --- Relationship to Other Skills rn-async-patterns: Use post-condition validation in tests to verify async flows rn-zustand-patterns: Understand getState() behavior for store tests rn-state-flows: Integration tests should cover e …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/rn-testing

View the source on GitHub

Browse the @skills marketplace