Fix failing tests

- Replace --db flag tests with BEADS_DB env var tests in TestInitWithCustomDBPath
- Fix database closure issue in TestGitPullSyncIntegration by using local stores in subtests
- Remove backup files

Amp-Thread-ID: https://ampcode.com/threads/T-81a1f961-23c1-440b-b36f-d0ce823a5b16
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-27 20:08:50 -07:00
parent 1e2e066dc4
commit 6821b8ad4c
14 changed files with 2328 additions and 2235 deletions

View File

@@ -2,29 +2,17 @@ package main
import (
"context"
"os"
"path/filepath"
"testing"
"time"
"github.com/steveyegge/beads/internal/storage/sqlite"
"github.com/steveyegge/beads/internal/types"
)
func TestReadyWork(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()
// Create issues with different states
@@ -142,17 +130,7 @@ func TestReadyWork(t *testing.T) {
func TestReadyWorkWithAssignee(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()
// Create issues with different assignees
@@ -226,17 +204,7 @@ func TestReadyCommandInit(t *testing.T) {
func TestReadyWorkInProgress(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()
// Create in-progress issue (should be in ready work)