test(doctor): add tests to restore coverage above 45%

Add tests for doctor package functions after refactor PR #653:
- version_test.go: CompareVersions, IsValidSemver, ParseVersionParts
- types_test.go: status constants and DoctorCheck struct
- installation_test.go: CheckInstallation, CheckMultipleDatabases, CheckPermissions
- integrity_test.go: CheckIDFormat, CheckDependencyCycles, CheckTombstones, CheckDeletionsManifest
- database_test.go: CheckDatabaseVersion, CheckSchemaCompatibility, CheckDatabaseIntegrity
- daemon_test.go: CheckDaemonStatus
- git_test.go: CheckGitHooks, CheckMergeDriver, CheckSyncBranchConfig

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 17:43:18 -08:00
parent e9be35e374
commit 13a471fe45
7 changed files with 658 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package doctor
import (
"os"
"path/filepath"
"testing"
)
func TestCheckDaemonStatus(t *testing.T) {
t.Run("no beads directory", func(t *testing.T) {
tmpDir := t.TempDir()
check := CheckDaemonStatus(tmpDir, "1.0.0")
// Should return OK when no .beads directory (daemon not needed)
if check.Status != StatusOK {
t.Errorf("Status = %q, want %q", check.Status, StatusOK)
}
})
t.Run("beads directory exists", func(t *testing.T) {
tmpDir := t.TempDir()
beadsDir := filepath.Join(tmpDir, ".beads")
if err := os.Mkdir(beadsDir, 0755); err != nil {
t.Fatal(err)
}
check := CheckDaemonStatus(tmpDir, "1.0.0")
// Should check daemon status - may be OK or warning depending on daemon state
if check.Name != "Daemon Health" {
t.Errorf("Name = %q, want %q", check.Name, "Daemon Health")
}
})
}