Write Tests
Write comprehensive unit and integration tests with proper mocking and coverage
$ npx claude-code-templates@latest --command="testing/write-tests" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Write Tests
Write comprehensive unit and integration tests with framework-specific best practices: $ARGUMENTS
Current Testing Context
- Test framework: !
find . -name "jest.config." -o -name ".test.*" | head -1 && echo "Jest/Vitest detected" || echo "Detect framework" - Target file: Analysis of $ARGUMENTS for test requirements and complexity
- Project patterns: !
find . -name ".test." -o -name ".spec." | head -3existing test patterns - Coverage setup: !
grep -l "coverage" package.json jest.config.* 2>/dev/null | head -1 || echo "Setup needed"
Task
Execute comprehensive test writing with framework-specific optimizations and best practices:
Test Focus: Use $ARGUMENTS to specify target file, unit tests, integration tests, e2e tests, or component tests Test Writing Framework:- Code Analysis - Analyze target code structure, identify testable functions, assess dependency complexity, evaluate edge cases
- Test Strategy Design - Plan test organization, design test hierarchies, identify mock requirements, optimize test isolation
- Framework Integration - Setup framework-specific patterns, configure test utilities, implement proper assertions, optimize test performance
- Mock Implementation - Design dependency mocks, implement test doubles, create factory functions, setup async handling
- Test Case Generation - Write unit tests, integration tests, edge cases, error scenarios, performance tests, snapshot tests
- Quality Assurance - Ensure test maintainability, optimize execution speed, validate coverage, implement proper cleanup
Related Claude Code Commands
Generate Tests
Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.
Test Coverage
Analyze and improve test coverage with comprehensive reporting and gap identification
Generate Test Cases
Generate comprehensive test cases with automatic analysis and coverage optimization
E2e Setup
Configure comprehensive end-to-end testing suite with framework selection and CI integration
Test Automation Orchestrator
Orchestrate comprehensive test automation with intelligent execution and optimization
Setup Comprehensive Testing
Setup complete testing infrastructure with framework configuration and CI integration
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.