testing-strategy
Installation
SKILL.md
Testing Guidelines
Unit Tests
- Test one thing per test
- Use descriptive test names:
test_user_creation_fails_with_invalid_email - Mock external dependencies
- Keep tests fast and isolated
Integration Tests
- Test API endpoints with realistic data
- Verify database state changes
- Clean up test data after each test
- Use test fixtures for common scenarios
Running Tests
# Run all tests
npm test
# Run unit tests only
npm test:unit
# Run integration tests (requires database)
npm test:integration
# Run tests with coverage
npm test:coverage
Test Structure
tests/
├── unit/ # Fast, isolated unit tests
├── integration/ # Tests requiring external services
├── fixtures/ # Shared test data
└── helpers/ # Test utilities
Best Practices
- Arrange-Act-Assert: Structure tests clearly
- One assertion per test: When possible, test one behavior
- Descriptive names: Test names should describe the scenario
- No test interdependence: Tests should run in any order
- Clean state: Each test starts with a known state
Coverage Goals
- Aim for 80%+ line coverage
- Focus on critical paths first
- Don't sacrifice test quality for coverage numbers
Related skills
More from block/agent-skills
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
171code-review
Comprehensive code review checklist for pull requests
132api-setup
Set up API integration with configuration and helper scripts
69beads
Use beads (bd) for persistent task tracking in coding projects. A git-backed issue tracker designed for AI agents with dependency graphs, hierarchical tasks, and multi-agent coordination.
62rp-why
Gas Town × DOK Framework - A two-dimensional model for analyzing AI collaboration maturity and cognitive complexity to reveal growth opportunities.
45goose-blog-post
Write and publish blog posts for the block/goose open source project
27