Aller au contenu
login
arrow_backRetour aux issues
Wpnx330/pharos-cli #23

test: add unit tests for critical CLI commands (audit, doctor, update, import)

ecoDébutant help wanted good first issue testing

descriptionDescription

## Problem 19 of the CLI's command files have zero test coverage, including critical user-facing commands: - `audit.go` — security vulnerability scanning - `doctor.go` — health diagnostics - `update.go` — server updates - `import.go` — config import - `purge.go` — destructive registry operation - `login.go` — authentication - `stop.go` — process management - `daemon.go` — daemon management - `health.go` — registry health check ## Proposed fix Add unit tests for the most critical commands first: 1. `audit_test.go` — test `collectServersForAudit`, `filterApplicable`, `versionMatchesRange`, `compareVersions`, `parseSemver` 2. `doctor_test.go` — test `validateConfig` for each format type, `runCheck` 3. `update_test.go` — test version comparison logic, dry-run mode 4. `import_test.go` — test config import from each client format ## Acceptance criteria - [ ] Tests for audit, doctor, update, import commands - [ ] All tests pass with `go test ./... -count=1` - [ ] Test coverage for cmd/ package increased measurably - [ ] Tests use table-driven style consistent with existing test patterns
codeOuvre sur GitHub