--- name: test description: Generate tests for the current code or a specific file argument-hint: File path or test framework --- # Test Generation Target: $ARGUMENTS Generate tests for the specified file or the current changes. ## Process 1. If a file path is given, `read_file` it. Otherwise use `bash` to get `git diff HEAD` and identify changed files. 2. Identify the test framework in use: - Python: pytest (preferred), unittest - JavaScript: vitest, jest, mocha - Check `package.json` or `requirements.txt` for hints 3. Read existing tests in the `tests/` or `__tests__/` directory to match style. 4. Generate tests that cover: - Happy path (typical usage) - Edge cases (empty input, boundary values) - Error cases (invalid input, network failures) - Integration points (if applicable) 5. Write the test file to the appropriate location using `write_file`. 6. Run the tests with `bash` to verify they pass. ## Rules - One test file per source file (e.g. `src/auth.py` → `tests/test_auth.py`) - Use descriptive test names: `test_user_can_login_with_valid_credentials` - Arrange-Act-Assert pattern - Don't test the framework — test your code's behavior - Mock external dependencies (network, filesystem, time) when flaky