diff --git a/docs/AGENTS.md b/docs/AGENTS.md index 3f0f5c9..08e97bd 100644 --- a/docs/AGENTS.md +++ b/docs/AGENTS.md @@ -194,3 +194,40 @@ for i in range(10): ``` ``` + + +## Test Coverage Tracking + +The project uses SimpleCov to track test coverage. Coverage data is stored in `coverage/.resultset.json` after each test run. + +### Coverage Information +- **Location**: `coverage/.resultset.json` +- **Format**: JSON file with line-by-line coverage data for each Ruby file +- **Generated by**: SimpleCov gem (runs automatically with tests) +- **HTML Report**: `coverage/index.html` (open in browser for detailed report) + +### Reading Coverage Data + +When checking test coverage: +1. Run tests: `bin/rails test` +2. Check overall coverage in console output (e.g., "Line Coverage: 85.7% (707 / 825)") +3. For detailed per-file coverage: open `coverage/index.html` in a browser +4. The `.resultset.json` file contains raw coverage data if programmatic access is needed + +### Coverage Goals +- Aim for **80%+ line coverage** for all models and helpers +- Controllers should have **all actions tested** (both success and error paths) +- Critical business logic should have **100% coverage** + +### Files Excluded from Coverage +- `config/` - Configuration files +- `db/` - Database migrations and schema +- `test/` - Test files themselves +- `vendor/` - Third-party code + +### Coverage Notes for Agents +- Always run tests after making changes to verify coverage isn't decreasing +- If adding new methods/classes, add corresponding tests +- Coverage report shows which lines are NOT covered (highlighted in red in HTML report) +- Missing coverage often indicates edge cases or error paths not tested + diff --git a/docs/TODO.md b/docs/TODO.md index feb79ee..5124b0e 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -109,14 +109,29 @@ ## Testing -- [ ] **Controller tests** for all actions -- [ ] **System tests** for critical user flows - - [ ] Public browsing and search - - [ ] Contributor creates/edits entry - - [ ] Reviewer workflow - - [ ] Admin user management -- [ ] **Integration tests** for authentication flows -- [ ] **Performance tests** for search queries +- [x] **Controller tests** for all actions + - [x] EntriesController (index, show, edit, update, download, filters, search) + - [x] PasswordResetsController (new, create, edit, update, token validation) + - [x] Existing tests: Sessions, Invitations, Setup, Admin controllers, Comments, Requests +- [x] **System tests** for critical user flows + - [x] Public browsing and search + - [x] Contributor creates/edits entry + - [ ] Reviewer workflow (pending feature implementation) + - [x] Admin user management +- [x] **Integration tests** for authentication flows + - [x] Sign in/sign out flows + - [x] Remember me functionality + - [x] Session timeout + - [x] Rate limiting + - [x] Password reset flow + - [x] Invitation acceptance flow +- [x] **Performance tests** for search queries + - [x] Full text search benchmarks + - [x] Language-specific search + - [x] Alphabetical browsing + - [x] Category filtering + - [x] Combined filters + - [x] XLSX download performance ## Deployment