Agent skill · software engineering · sickn33
code-showcase-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.
Why this skill is useful
Provides specific Jest testing patterns and factory functions that enhance unit testing capabilities beyond generic knowledge.
What it needs
About 3k tokens when loaded. Last updated 2026-08-07. 44,571 stars on the source repository.
What this skill does
Testing Patterns and Utilities When to Use Use this skill when you need 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. 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: Usage: 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 Not Using Factories Best Practices 1. Always use factory functions for props and data 2. Test behavior, not implementation 3. Use descriptive test names 4. Organize with describe blocks 5. Clear mocks between tests 6. Keep tests focused - one behavior per test Running Tests Integration with Other Skills react-ui-patterns: Test all UI states (loading, error, empty, success) systematic-debugging: Write test that reproduces bug before fixing Limitations Use this skill only when the task clearly matches its upstream source and local project context. Verify commands, generated code, dependencies, credentials, and external service behavior before applying changes. Do not treat examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills sickn33/code-showcase-testing-patterns--a83bc2