Generate comprehensive tests for specified code.
- Read the target file(s)
- Identify testable units (functions, classes, methods)
- Generate tests following project conventions
- Ensure high coverage of edge cases
- Identify public interfaces
- Understand dependencies
- Note edge cases and boundaries
Check for:
jest.config.js→ Jestvitest.config.ts→ Vitestpytest.ini→ pytestmochain package.json → Mocha
Follow the detected framework conventions.
Normal expected behavior with valid input.
- Empty inputs
- Null/undefined values
- Boundary values (0, -1, MAX_INT)
- Single item vs multiple items
- Invalid input types
- Missing required parameters
- Network/IO failures
- Timeout scenarios
- Database interactions
- External API calls
- File system operations
describe('[ComponentName]', () => {
describe('[methodName]', () => {
// Happy path
it('should [expected behavior] when [condition]', () => {
// Arrange
// Act
// Assert
});
// Edge cases
it('should handle empty input', () => {});
it('should handle null values', () => {});
// Error cases
it('should throw when [invalid condition]', () => {});
});
});- One assertion per test (when practical)
- Descriptive test names
- AAA pattern (Arrange-Act-Assert)
- No test interdependence
- Mock external dependencies
/generate-tests src/utils/calculator.ts
/generate-tests src/services/
$ARGUMENTS