bd sync: 2025-12-27 15:56:42

This commit is contained in:
Steve Yegge
2025-12-27 15:56:42 -08:00
parent 87f535a65e
commit c8b912cbe6
179 changed files with 3051 additions and 10283 deletions

View File

@@ -1,43 +0,0 @@
package doctor
import (
"os"
"path/filepath"
"testing"
)
func TestCheckJSONLIntegrity_MalformedLine(t *testing.T) {
ws := t.TempDir()
beadsDir := filepath.Join(ws, ".beads")
if err := os.MkdirAll(beadsDir, 0755); err != nil {
t.Fatal(err)
}
jsonlPath := filepath.Join(beadsDir, "issues.jsonl")
if err := os.WriteFile(jsonlPath, []byte("{\"id\":\"t-1\"}\n{not json}\n"), 0644); err != nil {
t.Fatal(err)
}
// Ensure DB exists so check suggests auto-repair.
if err := os.WriteFile(filepath.Join(beadsDir, "beads.db"), []byte("x"), 0644); err != nil {
t.Fatal(err)
}
check := CheckJSONLIntegrity(ws)
if check.Status != StatusError {
t.Fatalf("expected StatusError, got %v (%s)", check.Status, check.Message)
}
if check.Fix == "" {
t.Fatalf("expected Fix guidance")
}
}
func TestCheckJSONLIntegrity_NoJSONL(t *testing.T) {
ws := t.TempDir()
beadsDir := filepath.Join(ws, ".beads")
if err := os.MkdirAll(beadsDir, 0755); err != nil {
t.Fatal(err)
}
check := CheckJSONLIntegrity(ws)
if check.Status != StatusOK {
t.Fatalf("expected StatusOK, got %v (%s)", check.Status, check.Message)
}
}