From e79558a9729f5308de8cb35be843b2b3011a0a9c Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Tue, 23 Dec 2025 00:04:55 -0800 Subject: [PATCH] fix: make database_removal_scenario test more realistic The test was creating an empty .beads/ directory after simulating rm -rf, but FindBeadsDir() requires some project files (config.yaml, metadata.json, or *.db/*.jsonl) to recognize a directory as a valid beads directory. Updated the test to create a minimal config.yaml like bd init actually does before auto-import runs. This makes the test more realistic and fixes the flakiness. --- cmd/bd/reinit_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/bd/reinit_test.go b/cmd/bd/reinit_test.go index d844cadb..f226dd2b 100644 --- a/cmd/bd/reinit_test.go +++ b/cmd/bd/reinit_test.go @@ -158,9 +158,14 @@ func testDatabaseRemovalScenario(t *testing.T) { runCmd(t, dir, "git", "add", ".beads/issues.jsonl") runCmd(t, dir, "git", "commit", "-m", "Add issues") - // Simulate rm -rf .beads/ + // Simulate rm -rf .beads/ followed by partial bd init + // (in practice, bd init creates config.yaml before auto-import) os.RemoveAll(beadsDir) os.MkdirAll(beadsDir, 0755) + // Create minimal config so FindBeadsDir recognizes this as a beads directory + if err := os.WriteFile(filepath.Join(beadsDir, "config.yaml"), []byte("issue-prefix: test\n"), 0644); err != nil { + t.Fatalf("Failed to write config.yaml: %v", err) + } // Change to test directory t.Chdir(dir)