testing-patterns

Installation
Summary

Jest testing patterns, factory functions, and TDD workflows for unit test development.

  • Covers TDD red-green-refactor cycle, behavior-driven testing focused on public APIs, and factory pattern for reusable test data and component props
  • Provides custom render utilities, mock strategies for modules and GraphQL hooks, and structured test organization with describe blocks
  • Includes query patterns (getBy, queryBy, findBy), user interaction simulation with fireEvent, and anti-patterns to avoid like testing mock behavior instead of real behavior
  • Best practices emphasize factory functions, descriptive test names, clearing mocks between tests, and keeping tests focused on single behaviors
SKILL.md

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
Related skills
Installs
665
GitHub Stars
37.3K
First Seen
Jan 19, 2026