Files
beads/internal/storage/sqlite/migrations_template_pinned_regression_test.go
Steve Yegge 1611f16751 refactor: remove unused bd pin/unpin/hook commands (bd-x0zl)
Analysis found these commands are dead code:
- gt never calls `bd pin` - uses `bd update --status=pinned` instead
- Beads.Pin() wrapper exists but is never called
- bd hook functionality duplicated by gt mol status
- Code comment says "pinned field is cosmetic for bd hook visibility"

Removed:
- cmd/bd/pin.go
- cmd/bd/unpin.go
- cmd/bd/hook.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:02:15 -08:00

60 lines
1.2 KiB
Go

package sqlite
import (
"context"
"path/filepath"
"testing"
"github.com/steveyegge/beads/internal/types"
)
func TestRunMigrations_DoesNotResetPinnedOrTemplate(t *testing.T) {
ctx := context.Background()
dir := t.TempDir()
dbPath := filepath.Join(dir, "beads.db")
s, err := New(ctx, dbPath)
if err != nil {
t.Fatalf("New: %v", err)
}
t.Cleanup(func() { _ = s.Close() })
if err := s.SetConfig(ctx, "issue_prefix", "test"); err != nil {
t.Fatalf("SetConfig(issue_prefix): %v", err)
}
issue := &types.Issue{
Title: "Pinned template",
Status: types.StatusOpen,
Priority: 2,
IssueType: types.TypeTask,
Pinned: true,
IsTemplate: true,
}
if err := s.CreateIssue(ctx, issue, "test-user"); err != nil {
t.Fatalf("CreateIssue: %v", err)
}
_ = s.Close()
s2, err := New(ctx, dbPath)
if err != nil {
t.Fatalf("New(reopen): %v", err)
}
defer func() { _ = s2.Close() }()
got, err := s2.GetIssue(ctx, issue.ID)
if err != nil {
t.Fatalf("GetIssue: %v", err)
}
if got == nil {
t.Fatalf("expected issue to exist")
}
if !got.Pinned {
t.Fatalf("expected issue to remain pinned")
}
if !got.IsTemplate {
t.Fatalf("expected issue to remain template")
}
}