testing-patterns
Jest testing patterns, factory functions, mocking strategies, and TDD workflow. Use when writing unit tests, creating test factories, or following TDD red-green-refactor cycle.
npx skills add sickn33/agentic-awesome-skills --skill testing-patterns --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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: ```typescript // 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:** ```typescript import { renderWithTheme } from 'utils/testUtils'; import { screen } from '@testing-library/react-native'; it('should render component', () => { renderWithTheme(<MyComponent />); expect(screen.
- Testing Philosophy
- Test Utilities
- Custom Render Function
- Factory Pattern
- Component Props Factory
- Data Factory
- Mocking Patterns
- Mocking Modules
- Mocking GraphQL Hooks
- Test Structure
- Query Patterns
- User Interaction Patterns
- Anti-Patterns to Avoid
- Testing Mock Behavior Instead of Real Behavior
Run all tests npm test Run with coverage npm run test:coverage Run specific file npm test ComponentName.test.tsx
What does the testing-patterns skill do?
Jest testing patterns, factory functions, mocking strategies, and TDD workflow. Use when writing unit tests, creating test factories, or following TDD red-green-refactor cycle.
How do I install it?
Run `npx skills add sickn33/agentic-awesome-skills --skill testing-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From sickn33/agentic-awesome-skills, a repository with 44,414 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.