Files
dnswatcher/internal
user 0219d7e6e1
All checks were successful
check / check (push) Successful in 43s
test(config): add comprehensive tests for config loading path
Add tests covering the main configuration loading path which was
previously untested (only ClassifyTargets and PSL logic had tests).

New test coverage:
- New() constructor with default values, env overrides, and error cases
- buildConfig() interval parsing with fallback to defaults on invalid input
- setupViper() env prefix binding and default value registration
- parseCSV() edge cases: whitespace, trailing/leading commas, empty segments
- configureDebugLogging() debug mode activation
- StatePath() path construction with various DataDir values
- ErrNoTargets sentinel error for missing/empty targets
- PORT env without DNSWATCHER_ prefix (compatibility)
- Target classification into domains vs hostnames via PSL
- Invalid targets (public suffixes) rejected with clear error

Coverage for internal/config increased from 23% to 92.5%.
2026-03-01 23:56:21 -08:00
..