agentsclimarketplace

React native testing

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/react-native-testing

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill react-native-testing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Jest and React Native Testing Library for component and integration tests. Use when writing Jest or React Native Testing Library tests for React Native components. (triggers: **/*.test.tsx, **/*.spec.tsx, __tests__/**, test, testing, jest, render, fireEvent, waitFor)

SKILL.md

1.7 KB, 330 tokens by cl100k_base, as published. Nobody here has run it

React Native Testing

Priority: P1 (OPERATIONAL)

Setup

  • Jest: Pre-configured in React Native.
  • Testing Library: Use @testing-library/react-native for user-centric tests.
  • Mocking: Use jest.mock() for native modules.

Component Testing

import { render, fireEvent, waitFor } from '@testing-library/react-native';

test('increments counter on button press', () => {
  const { getByText, getByRole } = render(<Counter />);
  const button = getByRole('button', { name: /increment/i });

  fireEvent.press(button);

  expect(getByText('Count: 1')).toBeTruthy();
});

Async Testing

test('fetches and displays data', async () => {
  const { findByText } = render(<DataComponent />);
  const element = await findByText(/loaded data/i);
  expect(element).toBeTruthy();
});

Best Practices

  • User-Centric: Use getByRole, getByText over testID when possible.
  • Integration > Unit: Test features, not implementation.
  • Avoid Snapshots: Use sparingly. Brittle and hard to review.
  • Coverage: Aim for 70%+. Focus on critical paths.

Anti-Patterns

  • No Testing Implementation: Test behavior, not internals.
  • No testID Overuse: Prefer accessible queries.

References

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.