Fix remaining test database initialization errors (bd-207)
Fixed 38 tests failing with 'database not initialized: issue_prefix config is missing' by replacing manual sqlite.New() calls with test helper functions. Modified files: - dep_test.go (4 tests) - merge_test.go (4 tests) - export_import_test.go (4 instances) - import_collision_test.go (10 instances) - import_bug_test.go (1 instance) - import_collision_regression_test.go (2 instances) - import_idempotent_test.go (2 instances) - init_test.go (4 instances) - integrity_test.go (3 tests) - main_test.go (multiple tests) All database initialization errors are now resolved. Remaining test failures (2) are unrelated to database initialization. Amp-Thread-ID: https://ampcode.com/threads/T-a6b09458-b899-49eb-9a62-346fa67f62c7 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -3,12 +3,10 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
@@ -16,15 +14,7 @@ func TestDepAdd(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
dbPath := filepath.Join(tmpDir, ".beads", "beads.db")
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sqliteStore, err := sqlite.New(dbPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer sqliteStore.Close()
|
||||
sqliteStore := newTestStore(t, dbPath)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -85,15 +75,7 @@ func TestDepTypes(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
dbPath := filepath.Join(tmpDir, ".beads", "beads.db")
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sqliteStore, err := sqlite.New(dbPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer sqliteStore.Close()
|
||||
sqliteStore := newTestStore(t, dbPath)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -142,15 +124,7 @@ func TestDepCycleDetection(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
dbPath := filepath.Join(tmpDir, ".beads", "beads.db")
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sqliteStore, err := sqlite.New(dbPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer sqliteStore.Close()
|
||||
sqliteStore := newTestStore(t, dbPath)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -235,15 +209,7 @@ func TestDepRemove(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
dbPath := filepath.Join(tmpDir, ".beads", "beads.db")
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sqliteStore, err := sqlite.New(dbPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer sqliteStore.Close()
|
||||
sqliteStore := newTestStore(t, dbPath)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user