test: add cmd/bd helper coverage and stabilize test runner

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Jordan Hubbard
2025-12-26 17:55:51 -04:00
parent 28f2c76589
commit 0b6ec57928
8 changed files with 318 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import (
"runtime"
"testing"
"github.com/steveyegge/beads/internal/git"
"github.com/steveyegge/beads/internal/storage/sqlite"
"github.com/steveyegge/beads/internal/types"
)
@@ -90,6 +91,7 @@ func testFreshCloneAutoImport(t *testing.T) {
// Test checkGitForIssues detects issues.jsonl
t.Chdir(dir)
git.ResetCaches()
count, path, gitRef := checkGitForIssues()
if count != 1 {
@@ -169,6 +171,7 @@ func testDatabaseRemovalScenario(t *testing.T) {
// Change to test directory
t.Chdir(dir)
git.ResetCaches()
// Test checkGitForIssues finds issues.jsonl (canonical name)
count, path, gitRef := checkGitForIssues()
@@ -247,6 +250,7 @@ func testLegacyFilenameSupport(t *testing.T) {
// Change to test directory
t.Chdir(dir)
git.ResetCaches()
// Test checkGitForIssues finds issues.jsonl
count, path, gitRef := checkGitForIssues()
@@ -323,6 +327,7 @@ func testPrecedenceTest(t *testing.T) {
// Change to test directory
t.Chdir(dir)
git.ResetCaches()
// Test checkGitForIssues prefers issues.jsonl
count, path, _ := checkGitForIssues()
@@ -369,6 +374,7 @@ func testInitSafetyCheck(t *testing.T) {
// Change to test directory
t.Chdir(dir)
git.ResetCaches()
// Create empty database (simulating failed import)
dbPath := filepath.Join(beadsDir, "test.db")