Back to Skills

react-native-web-testing

verified

Use when testing React Native Web applications. Provides patterns for Jest, React Native Testing Library, component testing, and web-specific testing strategies.

View on GitHub

Marketplace

han

TheBushidoCollective/han

Plugin

jutsu-react-native-web

Technique

Repository

TheBushidoCollective/han
60stars

jutsu/jutsu-react-native-web/skills/react-native-web-testing/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-react-native-web/skills/react-native-web-testing/SKILL.md -a claude-code --skill react-native-web-testing

Installation paths:

Claude
.claude/skills/react-native-web-testing/
Powered by add-skill CLI

Instructions

# React Native Web - Testing

Comprehensive testing patterns for React Native Web applications using Jest and React Native Testing Library.

## Key Concepts

### React Native Testing Library

The standard testing library for React Native components:

```typescript
import { render, screen, fireEvent } from '@testing-library/react-native';
import { Button } from './Button';

describe('Button', () => {
  it('calls onPress when pressed', () => {
    const onPress = jest.fn();
    render(<Button title="Click me" onPress={onPress} />);

    const button = screen.getByText('Click me');
    fireEvent.press(button);

    expect(onPress).toHaveBeenCalledTimes(1);
  });
});
```

### Jest Configuration

Configure Jest for React Native Web:

```javascript
// jest.config.js
module.exports = {
  preset: 'react-native',
  moduleNameMapper: {
    '^react-native$': 'react-native-web',
  },
  transformIgnorePatterns: [
    'node_modules/(?!(react-native|@react-native|react-native-web)/)',
  ],
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
};
```

### Testing Utilities

Common testing utilities and helpers:

```typescript
import { render, RenderOptions } from '@testing-library/react-native';
import { ReactElement } from 'react';
import { ThemeProvider } from './theme';

interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {
  theme?: Theme;
}

export function renderWithProviders(
  ui: ReactElement,
  { theme = defaultTheme, ...options }: CustomRenderOptions = {}
) {
  return render(
    <ThemeProvider value={theme}>
      {ui}
    </ThemeProvider>,
    options
  );
}
```

## Best Practices

### Component Testing

✅ Test user interactions and behavior:

```typescript
import { render, screen, fireEvent, waitFor } from '@testing-library/react-native';
import { LoginForm } from './LoginForm';

describe('LoginForm', () => {
  it('submits form with valid credentials', async () => {
    const onSubmit = jest.fn();
    render(<LoginForm onSubmit={onSubmit} />);

    const

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
9262 chars