Fix FK constraint failures in AddComment and ApplyCompaction (bd-5arw)
Amp-Thread-ID: https://ampcode.com/threads/T-4358e6e4-28ea-4ed7-ba3f-3da39072e169 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -339,3 +340,21 @@ func TestEventTypesInHistory(t *testing.T) {
|
||||
t.Error("Expected EventClosed in history")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddCommentNotFound(t *testing.T) {
|
||||
store, cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
|
||||
ctx := context.Background()
|
||||
nonExistentID := "bd-999"
|
||||
|
||||
err := store.AddComment(ctx, nonExistentID, "alice", "This should fail cleanly")
|
||||
if err == nil {
|
||||
t.Fatal("Expected error, got nil")
|
||||
}
|
||||
|
||||
expectedError := "issue bd-999 not found"
|
||||
if !strings.Contains(err.Error(), expectedError) {
|
||||
t.Errorf("Expected error to contain %q, got %q", expectedError, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user