Context
PR #16 brought test coverage from 16% to 51% by cherry-picking testing infrastructure from the coverage audit. The next step is reaching 70-80% with behavioral tests — tests that verify correct behavior, not just code execution.
Current coverage by package
| Package |
Coverage |
Target |
| api |
24.4% |
60%+ |
| auth |
0% |
70%+ |
| auth/mock |
79.7% |
— |
| cache |
35.1% |
70%+ |
| cmd |
18.8% |
40%+ |
| config |
69.5% |
80%+ |
| errors |
89.7% |
— |
| output |
79.6% |
— |
| version |
100% |
— |
Approach
The testing infrastructure from PR #16 provides the foundation:
- Mock infrastructure (
internal/auth/mock/, internal/mocks/)
- Interface definitions (
internal/interfaces/)
- Test utilities (
internal/testutil/)
Priority areas
- auth package — currently 0%, needs mock keyring tests for save/get/delete token flows
- api package — needs tests for API call methods using mock HTTP transport
- cache package — needs behavioral tests for TTL, expiration, concurrent access
- cmd package — focus on helper function tests (already started), avoid testing Cobra wiring
Quality guidelines
- Tests should verify behavior, not struct fields
- Each test should be able to catch a real bug
- Prefer fewer meaningful tests over many superficial ones
- Use the auth mock package as the quality template
Context
PR #16 brought test coverage from 16% to 51% by cherry-picking testing infrastructure from the coverage audit. The next step is reaching 70-80% with behavioral tests — tests that verify correct behavior, not just code execution.
Current coverage by package
Approach
The testing infrastructure from PR #16 provides the foundation:
internal/auth/mock/,internal/mocks/)internal/interfaces/)internal/testutil/)Priority areas
Quality guidelines