mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-06-08 23:39:46 +00:00
1b2516ce82
cmd/kportal: 0% -> 17.4% (testable surface only — main() is a 274-statement monolith with OS signals, bubbletea TUI, kubeconfig loading, signal-loop goroutines, and config watcher all in one function. Hitting 70% requires extracting it into run(args,w) int, which is a non-trivial refactor — out of scope for a coverage pass.) Tests cover: promptCreateConfig (yes/no/EOF/empty inputs via os.Pipe stdin redirection), contains, resolveGenerateConfigPath (all 4 system dirs + abs/rel branches), runGenerate (missing flag, -h, unknown flag, invalid context, malformed YAML, no-TTY error path). internal/version: 45.7% -> 97.8%. Added httptest.NewServer + custom rewriteTransport to redirect GitHub API calls. Covered NewChecker, fetchLatestRelease (200/403/404/429/500, malformed JSON, empty tag_name), CheckForUpdate (newer/same/current-newer/error/cancelled), parseVersion edge cases (empty, single digit, alpha).