chore(ai): add comprehensive CLI configurations for all AI assistants
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
73
.opencode/commands/write-tests.md
Normal file
73
.opencode/commands/write-tests.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Write Comprehensive Tests
|
||||
|
||||
Write comprehensive tests for the following functionality: $ARGUMENTS
|
||||
|
||||
## Testing Framework:
|
||||
1. **Test Planning**: Design test cases for all scenarios
|
||||
2. **Unit Testing**: Implement unit tests with high coverage
|
||||
3. **Integration Testing**: Create integration tests for component interactions
|
||||
4. **Property-Based Testing**: Implement property-based tests for mathematical functions
|
||||
5. **Fuzz Testing**: Add fuzz tests for edge cases
|
||||
6. **Benchmark Testing**: Create benchmarks for performance-critical code
|
||||
|
||||
## Testing Standards:
|
||||
- **Coverage Targets**: >90% for Go, >95% for Solidity, >85% for JavaScript
|
||||
- **Test Organization**: Follow language-specific testing conventions
|
||||
- **Test Data**: Use realistic test data and edge cases
|
||||
- **Test Documentation**: Document test scenarios and expected outcomes
|
||||
|
||||
## Language-Specific Testing:
|
||||
|
||||
### Go Testing
|
||||
```go
|
||||
// Unit tests with table-driven approach
|
||||
func TestFunctionName(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
input InputType
|
||||
expected OutputType
|
||||
wantErr bool
|
||||
}{
|
||||
// Test cases
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Test implementation
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Solidity Testing
|
||||
```solidity
|
||||
// Property-based testing with Foundry
|
||||
function testFuzz_ValidInputs_AlwaysWork(uint256 amount) public {
|
||||
vm.assume(amount > 0 && amount < type(uint128).max);
|
||||
// Test implementation
|
||||
}
|
||||
```
|
||||
|
||||
### JavaScript Testing
|
||||
```javascript
|
||||
// Vue component testing with Vitest
|
||||
describe('ComponentName', () => {
|
||||
it('should render correctly', () => {
|
||||
// Test implementation
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## Test Categories:
|
||||
- **Happy Path**: Tests for expected normal operation
|
||||
- **Edge Cases**: Tests for boundary conditions
|
||||
- **Error Conditions**: Tests for error handling
|
||||
- **Security**: Tests for potential vulnerabilities
|
||||
- **Performance**: Benchmarks for critical functions
|
||||
|
||||
## Deliverables:
|
||||
- Comprehensive test suite with high coverage
|
||||
- Property-based tests for mathematical functions
|
||||
- Fuzz tests for edge cases
|
||||
- Benchmark tests for performance-critical code
|
||||
- Test documentation and scenarios
|
||||
Reference in New Issue
Block a user