Aller au contenu
login
arrow_backRetour aux issues
HafidIdrissi/Time-Tracker #19

Expand validation coverage for category configuration

ecoDébutant enhancement help wanted good first issue

descriptionDescription

## User problem `config.json` controls how private activity is categorized. The loader validates many malformed inputs, but the test suite currently covers only a non-list `categories` value. A future change could weaken validation and make the app fail later with a confusing error. ## Expected result Add focused, table-driven unit tests for the validation rules already provided by `load_categorizer()`. Production code should change only if a test reveals a small, clearly demonstrated defect. ## Likely files - `tests/test_categories.py` - `timetracker/categories.py` only when a failing test exposes a defect ## Acceptance criteria - Cover invalid JSON and a configuration root that is not an object. - Cover a missing or non-list `categories` field. - Cover empty names, invalid `#RRGGBB` colors, and empty keyword lists. - Cover non-string and whitespace-only keywords. - Cover duplicate category names with different letter casing. - Verify that valid names and keywords are trimmed. - Use subtests or another compact pattern so failures identify the invalid case. - Assert useful `CategoryConfigError` messages without depending on an entire traceback. ## Test command ```powershell python -m unittest tests.test_categories -v python -m unittest discover -v ```
codeOuvre sur GitHub