Use when testing React Native Web applications. Provides patterns for Jest, React Native Testing Library, component testing, and web-specific testing strategies.
View on GitHubTheBushidoCollective/han
jutsu-react-native-web
jutsu/jutsu-react-native-web/skills/react-native-web-testing/SKILL.md
January 24, 2026
Select agents to install to:
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-testingInstallation paths:
.claude/skills/react-native-web-testing/# 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