Testing Patterns
Jest and React Native Testing Library patterns with factory functions, mocking strategies, and a TDD red-green-refactor workflow.
- CCM score
- 63 of 100
- skills.sh installs
- 306
- GitHub stars
- 34.3K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers test utilities, factory-based test data, module and GraphQL hook mocking, and test structure with describe blocks
- Includes a custom
renderWithThemewrapper, props and data factories followinggetMockX(overrides?), and query and interaction examples - Flags anti-patterns such as asserting on mock calls instead of rendered behavior, and duplicated inline test data
- Designed for React Native teams writing unit tests and following TDD
Install
$ npx -y skills add davila7/claude-code-templates --skill testing-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Testing Patterns and Utilities
Testing Philosophy
Test-Driven Development (TDD):
- Write failing test FIRST
- Implement minimal code to pass
- Refactor after green
- Never write production code without a failing test
Behavior-Driven Testing:
- Test behavior, not implementation
- Focus on public APIs and business requirements
- Avoid testing implementation details
- Use descriptive test names that describe behavior
Factory Pattern:
- Create
getMockX(overrides?: Partial<X>)functions - Provide sensible defaults
- Allow overriding specific properties
- Keep tests DRY and maintainable
Test Utilities
Custom Render Function
Create a custom render that wraps components with required providers:
// src/utils/testUtils.tsx
import { render } from '@testing-library/react-native';
import { ThemeProvider } from './theme';
export const renderWithTheme = (ui: React.ReactElement) => {
return render(
<ThemeProvider>{ui}</ThemeProvider>
);
};
Usage:
import { renderWithTheme } from 'utils/testUtils';
import { screen } from '@testing-library/react-native';
Details
- Repository
- github.com/davila7/claude-code-templates
- Categories
- Testing & QA, Frontend & UI Code, Mobile Apps
- First seen
- Jun 3, 2026
Questions
What does the testing-patterns skill do?
testing-patterns gives an agent Jest testing patterns, factory functions, mocking strategies and a TDD red-green-refactor workflow. It guides writing unit tests, building test factories such as getMockX overrides, and mocking modules and GraphQL hooks.
How do I install testing-patterns?
Run npx -y skills add davila7/claude-code-templates --skill testing-patterns -y in your project. After that, testing-patterns lets the agent write Jest unit tests that follow the TDD cycle and reusable test data factories.
Which other skills are in the Testing & QA category with testing-patterns?
testing-patterns sits in the Testing & QA category with tdd, migrate-to-shoehorn, test-driven-development, webapp-testing and break-ui. Its own focus is factory-based Jest test data, mocking patterns and React Native style query and interaction examples.
When should an agent use the testing-patterns skill?
testing-patterns applies when an agent writes unit tests, creates test factories, or follows the TDD red-green-refactor cycle. It also covers custom render helpers that wrap components with providers, and anti-patterns such as testing mock behavior instead of real behavior.
More from davila7/claude-code-templates
All 398- Red Team Tactics305
- Neurokit2302
- Fluidsim301
- Regulatory Affairs Head299
- Agent Management296
- Kegg Database295
- Langfuse291
- Quality Manager Qmr290
- Tdd Workflow290
- Get Available Resources289
- Gwas Database289
- Torch Geometric289
- Pubchem Database288
- Railway Status288
- Loki Mode285
- Viral Generator Builder285
- Railway Docs284
- Railway New284
- Bioservices282
- Railway Environment282
- Railway Projects282
- Railway Service282
- Anndata281
- Cocoindex281
Similar to Testing Patterns
More Testing & QAreact-native-testingcallstack/react-native-testing-library5.7K installsGuide for writing React Native component tests with Testing Library v13 and v14, covering queries, matchers, and async patterns.
Testing Anti-Patternsbobmatnyc/claude-mpm-skills390 installsAuthoritative guide for avoiding testing anti-patterns, covering mock misuse, test-only production code, and incomplete mocks.
javascript-typescript-jestgithub/awesome-copilot14.7K installsBest practices for Jest tests in JavaScript and TypeScript covering structure, mocking, async code, and React.
jest-react-testingmanutej/luxor-claude-marketplace1.2K installsComprehensive Jest and React Testing Library guidance for configuration, mocking, async, and hook tests.
javascript-testing-patternswshobson/agents21.6K installsComprehensive testing guide covering Jest and Vitest setup, unit, async, and mocking patterns for JavaScript and TypeScript.
vitest-testing-patternscuriositech/some_claude_skills376 installsPractical test-writing guide for Vitest and React Testing Library covering API routes, components, utilities, and mocking patterns.