Files
beads/internal/storage/sqlite/test_helpers.go
2025-11-01 23:56:03 -07:00

27 lines
642 B
Go

package sqlite
import (
"context"
"testing"
)
// newTestStore creates a SQLiteStorage with issue_prefix configured (bd-166)
// This prevents "database not initialized" errors in tests
func newTestStore(t *testing.T, dbPath string) *SQLiteStorage {
t.Helper()
store, err := New(dbPath)
if err != nil {
t.Fatalf("Failed to create test database: %v", err)
}
// CRITICAL (bd-166): Set issue_prefix to prevent "database not initialized" errors
ctx := context.Background()
if err := store.SetConfig(ctx, "issue_prefix", "bd"); err != nil {
_ = store.Close()
t.Fatalf("Failed to set issue_prefix: %v", err)
}
return store
}