Fix goconst linter warnings by converting repeated strings to constants
- Added testUserAlice constant for 'alice' in test files - Added windowsOS constant for 'windows' in test files - Added testIssueBD1/testIssueBD2 constants for 'bd-1'/'bd-2' in test files - Added testVersion100 constant for '1.0.0' in version tests - Added testIssueCustom1 constant for 'custom-1' in lazy init tests Closes bd-54 Amp-Thread-ID: https://ampcode.com/threads/T-0a4e5d44-2d95-4948-8f4a-d8facf8657c7 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,6 +11,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const testUserAlice = "alice"
|
||||
|
||||
func TestCommentsCommand(t *testing.T) {
|
||||
tmpDir, err := os.MkdirTemp("", "bd-test-comments-*")
|
||||
if err != nil {
|
||||
@@ -41,7 +43,7 @@ func TestCommentsCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("add comment", func(t *testing.T) {
|
||||
comment, err := s.AddIssueComment(ctx, issue.ID, "alice", "This is a test comment")
|
||||
comment, err := s.AddIssueComment(ctx, issue.ID, testUserAlice, "This is a test comment")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to add comment: %v", err)
|
||||
}
|
||||
@@ -49,7 +51,7 @@ func TestCommentsCommand(t *testing.T) {
|
||||
if comment.IssueID != issue.ID {
|
||||
t.Errorf("Expected issue ID %s, got %s", issue.ID, comment.IssueID)
|
||||
}
|
||||
if comment.Author != "alice" {
|
||||
if comment.Author != testUserAlice {
|
||||
t.Errorf("Expected author alice, got %s", comment.Author)
|
||||
}
|
||||
if comment.Text != "This is a test comment" {
|
||||
|
||||
@@ -18,11 +18,13 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const windowsOS = "windows"
|
||||
|
||||
func makeSocketTempDir(t testing.TB) string {
|
||||
t.Helper()
|
||||
|
||||
base := "/tmp"
|
||||
if runtime.GOOS == "windows" {
|
||||
if runtime.GOOS == windowsOS {
|
||||
base = os.TempDir()
|
||||
} else if _, err := os.Stat(base); err != nil {
|
||||
base = os.TempDir()
|
||||
|
||||
@@ -10,6 +10,11 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const (
|
||||
testIssueBD1 = "bd-1"
|
||||
testIssueBD2 = "bd-2"
|
||||
)
|
||||
|
||||
// TestRemapCollisionsRemapsImportedNotExisting verifies the bug fix where collision
|
||||
// resolution incorrectly modified existing issue dependencies.
|
||||
//
|
||||
@@ -38,7 +43,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
// Step 1: Create existing issues with dependencies
|
||||
existingIssues := []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing BD-1",
|
||||
Description: "Original database issue 1, depends on bd-2",
|
||||
Status: types.StatusOpen,
|
||||
@@ -46,7 +51,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
},
|
||||
{
|
||||
ID: "bd-2",
|
||||
ID: testIssueBD2,
|
||||
Title: "Existing BD-2",
|
||||
Description: "Original database issue 2",
|
||||
Status: types.StatusOpen,
|
||||
@@ -56,7 +61,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
{
|
||||
ID: "bd-3",
|
||||
Title: "Existing BD-3",
|
||||
Description: "Original database issue 3, depends on bd-1",
|
||||
Description: "Original database issue 3, depends on " + testIssueBD1,
|
||||
Status: types.StatusOpen,
|
||||
Priority: 2,
|
||||
IssueType: types.TypeTask,
|
||||
@@ -71,13 +76,13 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
|
||||
// Add dependencies between existing issues
|
||||
dep1 := &types.Dependency{
|
||||
IssueID: "bd-1",
|
||||
DependsOnID: "bd-2",
|
||||
IssueID: testIssueBD1,
|
||||
DependsOnID: testIssueBD2,
|
||||
Type: types.DepBlocks,
|
||||
}
|
||||
dep2 := &types.Dependency{
|
||||
IssueID: "bd-3",
|
||||
DependsOnID: "bd-1",
|
||||
DependsOnID: testIssueBD1,
|
||||
Type: types.DepBlocks,
|
||||
}
|
||||
if err := store.AddDependency(ctx, dep1, "test"); err != nil {
|
||||
@@ -90,7 +95,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
// Step 2: Simulate importing issues with same IDs but different content
|
||||
importedIssues := []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Imported BD-1",
|
||||
Description: "From import",
|
||||
Status: types.StatusOpen,
|
||||
@@ -98,7 +103,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
},
|
||||
{
|
||||
ID: "bd-2",
|
||||
ID: testIssueBD2,
|
||||
Title: "Imported BD-2",
|
||||
Description: "From import",
|
||||
Status: types.StatusOpen,
|
||||
@@ -172,7 +177,7 @@ func TestRemapCollisionsRemapsImportedNotExisting(t *testing.T) {
|
||||
t.Errorf("Expected 1 dependency for bd-3, got %d", len(existingDeps3))
|
||||
} else {
|
||||
// Verify the dependency is correct
|
||||
if existingDeps3[0].DependsOnID != "bd-1" {
|
||||
if existingDeps3[0].DependsOnID != testIssueBD1 {
|
||||
t.Errorf("Expected bd-3 → bd-1, got bd-3 → %s", existingDeps3[0].DependsOnID)
|
||||
}
|
||||
}
|
||||
@@ -206,7 +211,7 @@ func TestRemapCollisionsDoesNotUpdateNonexistentDependencies(t *testing.T) {
|
||||
|
||||
// Step 1: Create existing issue with dependency
|
||||
existing1 := &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing BD-1",
|
||||
Description: "Original database issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -214,7 +219,7 @@ func TestRemapCollisionsDoesNotUpdateNonexistentDependencies(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
}
|
||||
existing2 := &types.Issue{
|
||||
ID: "bd-2",
|
||||
ID: testIssueBD2,
|
||||
Title: "Existing BD-2",
|
||||
Description: "Original database issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -230,8 +235,8 @@ func TestRemapCollisionsDoesNotUpdateNonexistentDependencies(t *testing.T) {
|
||||
|
||||
// Add dependency between existing issues
|
||||
existingDep := &types.Dependency{
|
||||
IssueID: "bd-1",
|
||||
DependsOnID: "bd-2",
|
||||
IssueID: testIssueBD1,
|
||||
DependsOnID: testIssueBD2,
|
||||
Type: types.DepBlocks,
|
||||
}
|
||||
if err := store.AddDependency(ctx, existingDep, "test"); err != nil {
|
||||
@@ -241,7 +246,7 @@ func TestRemapCollisionsDoesNotUpdateNonexistentDependencies(t *testing.T) {
|
||||
// Step 2: Import colliding issues (without dependencies in DB)
|
||||
imported := []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Imported BD-1",
|
||||
Description: "From import, will be remapped",
|
||||
Status: types.StatusOpen,
|
||||
@@ -276,7 +281,7 @@ func TestRemapCollisionsDoesNotUpdateNonexistentDependencies(t *testing.T) {
|
||||
if len(existingDeps) != 1 {
|
||||
t.Errorf("Expected 1 dependency for existing bd-1, got %d (dependency should not be touched)", len(existingDeps))
|
||||
} else {
|
||||
if existingDeps[0].DependsOnID != "bd-2" {
|
||||
if existingDeps[0].DependsOnID != testIssueBD2 {
|
||||
t.Errorf("Expected bd-1 → bd-2, got bd-1 → %s", existingDeps[0].DependsOnID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func (h *listTestHelper) createTestIssues() {
|
||||
Priority: 1,
|
||||
IssueType: types.TypeFeature,
|
||||
Status: types.StatusInProgress,
|
||||
Assignee: "alice",
|
||||
Assignee: testUserAlice,
|
||||
},
|
||||
{
|
||||
Title: "Task Issue",
|
||||
@@ -128,10 +128,10 @@ func TestListCommand(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("filter by assignee", func(t *testing.T) {
|
||||
assignee := "alice"
|
||||
assignee := testUserAlice
|
||||
results := h.search(types.IssueFilter{Assignee: &assignee})
|
||||
h.assertCount(len(results), 1, "issues for alice")
|
||||
h.assertEqual("alice", results[0].Assignee, "assignee")
|
||||
h.assertEqual(testUserAlice, results[0].Assignee, "assignee")
|
||||
})
|
||||
|
||||
t.Run("filter by issue type", func(t *testing.T) {
|
||||
|
||||
@@ -556,7 +556,7 @@ func TestAutoFlushJSONLContent(t *testing.T) {
|
||||
|
||||
// TestAutoFlushErrorHandling tests error scenarios in flush operations
|
||||
func TestAutoFlushErrorHandling(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
if runtime.GOOS == windowsOS {
|
||||
t.Skip("chmod-based read-only directory behavior is not reliable on Windows")
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
sqlitestorage "github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
)
|
||||
|
||||
const testVersion100 = "1.0.0"
|
||||
|
||||
func TestVersionCompatibility(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -20,8 +22,8 @@ func TestVersionCompatibility(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "Exact version match",
|
||||
serverVersion: "1.0.0",
|
||||
clientVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: testVersion100,
|
||||
shouldWork: true,
|
||||
},
|
||||
{
|
||||
@@ -39,7 +41,7 @@ func TestVersionCompatibility(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Different major versions - client newer",
|
||||
serverVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: "2.0.0",
|
||||
shouldWork: false,
|
||||
errorContains: "incompatible major versions",
|
||||
@@ -47,13 +49,13 @@ func TestVersionCompatibility(t *testing.T) {
|
||||
{
|
||||
name: "Different major versions - daemon newer",
|
||||
serverVersion: "2.0.0",
|
||||
clientVersion: "1.0.0",
|
||||
clientVersion: testVersion100,
|
||||
shouldWork: false,
|
||||
errorContains: "incompatible major versions",
|
||||
},
|
||||
{
|
||||
name: "Empty client version (legacy client)",
|
||||
serverVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: "",
|
||||
shouldWork: true,
|
||||
},
|
||||
@@ -65,8 +67,8 @@ func TestVersionCompatibility(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Version without v prefix",
|
||||
serverVersion: "1.0.0",
|
||||
clientVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: testVersion100,
|
||||
shouldWork: true,
|
||||
},
|
||||
{
|
||||
@@ -182,8 +184,8 @@ func TestHealthCheckIncludesVersionInfo(t *testing.T) {
|
||||
defer store.Close()
|
||||
|
||||
// Set explicit versions
|
||||
ServerVersion = "1.0.0"
|
||||
ClientVersion = "1.0.0"
|
||||
ServerVersion = testVersion100
|
||||
ClientVersion = testVersion100
|
||||
|
||||
server := NewServer(socketPath, store)
|
||||
|
||||
@@ -246,7 +248,7 @@ func TestIncompatibleVersionInHealth(t *testing.T) {
|
||||
defer store.Close()
|
||||
|
||||
// Set incompatible versions
|
||||
ServerVersion = "1.0.0"
|
||||
ServerVersion = testVersion100
|
||||
ClientVersion = "2.0.0"
|
||||
|
||||
server := NewServer(socketPath, store)
|
||||
@@ -304,7 +306,7 @@ func TestVersionCheckMessage(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "Major mismatch - daemon older",
|
||||
serverVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: "2.0.0",
|
||||
expectError: true,
|
||||
errorContains: "Daemon is older; upgrade and restart daemon",
|
||||
@@ -312,13 +314,13 @@ func TestVersionCheckMessage(t *testing.T) {
|
||||
{
|
||||
name: "Major mismatch - client older",
|
||||
serverVersion: "2.0.0",
|
||||
clientVersion: "1.0.0",
|
||||
clientVersion: testVersion100,
|
||||
expectError: true,
|
||||
errorContains: "Client is older; upgrade the bd CLI",
|
||||
},
|
||||
{
|
||||
name: "Minor mismatch - daemon older",
|
||||
serverVersion: "1.0.0",
|
||||
serverVersion: testVersion100,
|
||||
clientVersion: "1.1.0",
|
||||
expectError: true,
|
||||
errorContains: "daemon 1.0.0 is older than client 1.1.0",
|
||||
@@ -326,7 +328,7 @@ func TestVersionCheckMessage(t *testing.T) {
|
||||
{
|
||||
name: "Compatible versions",
|
||||
serverVersion: "1.1.0",
|
||||
clientVersion: "1.0.0",
|
||||
clientVersion: testVersion100,
|
||||
expectError: false,
|
||||
},
|
||||
}
|
||||
@@ -366,7 +368,7 @@ func TestPingAndHealthBypassVersionCheck(t *testing.T) {
|
||||
defer store.Close()
|
||||
|
||||
// Set incompatible versions
|
||||
ServerVersion = "1.0.0"
|
||||
ServerVersion = testVersion100
|
||||
ClientVersion = "2.0.0"
|
||||
|
||||
server := NewServer(socketPath, store)
|
||||
@@ -440,8 +442,8 @@ func TestMetricsOperation(t *testing.T) {
|
||||
}
|
||||
defer store.Close()
|
||||
|
||||
ServerVersion = "1.0.0"
|
||||
ClientVersion = "1.0.0"
|
||||
ServerVersion = testVersion100
|
||||
ClientVersion = testVersion100
|
||||
|
||||
server := NewServer(socketPath, store)
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const testIssueBD1 = "bd-1"
|
||||
|
||||
func TestDetectCollisions(t *testing.T) {
|
||||
// Create temporary database
|
||||
tmpDir, err := os.MkdirTemp("", "collision-test-*")
|
||||
@@ -29,7 +31,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
|
||||
// Setup: Create some existing issues in the database
|
||||
existingIssue1 := &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing issue 1",
|
||||
Description: "This is an existing issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -66,7 +68,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
name: "exact match - idempotent import",
|
||||
incomingIssues: []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing issue 1",
|
||||
Description: "This is an existing issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -98,7 +100,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
name: "collision - same ID, different title",
|
||||
incomingIssues: []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Modified title",
|
||||
Description: "This is an existing issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -113,7 +115,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
if len(collisions) != 1 {
|
||||
t.Fatalf("expected 1 collision, got %d", len(collisions))
|
||||
}
|
||||
if collisions[0].ID != "bd-1" {
|
||||
if collisions[0].ID != testIssueBD1 {
|
||||
t.Errorf("expected collision ID bd-1, got %s", collisions[0].ID)
|
||||
}
|
||||
if len(collisions[0].ConflictingFields) != 1 {
|
||||
@@ -167,7 +169,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
incomingIssues: []*types.Issue{
|
||||
{
|
||||
// Exact match
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing issue 1",
|
||||
Description: "This is an existing issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -201,7 +203,7 @@ func TestDetectCollisions(t *testing.T) {
|
||||
name: "collision - estimated_minutes differs",
|
||||
incomingIssues: []*types.Issue{
|
||||
{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Existing issue 1",
|
||||
Description: "This is an existing issue",
|
||||
Status: types.StatusOpen,
|
||||
@@ -258,7 +260,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "identical issues",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test desc",
|
||||
Status: types.StatusOpen,
|
||||
@@ -266,7 +268,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test desc",
|
||||
Status: types.StatusOpen,
|
||||
@@ -278,7 +280,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "different title",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Original",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -286,7 +288,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Modified",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -298,7 +300,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "different status and priority",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -306,7 +308,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
IssueType: types.TypeTask,
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusClosed,
|
||||
@@ -318,7 +320,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "estimated_minutes - both nil",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -327,7 +329,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
EstimatedMinutes: nil,
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -340,7 +342,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "estimated_minutes - existing nil, incoming set",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -349,7 +351,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
EstimatedMinutes: nil,
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -362,7 +364,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
{
|
||||
name: "estimated_minutes - same values",
|
||||
existing: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -371,7 +373,7 @@ func TestCompareIssues(t *testing.T) {
|
||||
EstimatedMinutes: intPtr(60),
|
||||
},
|
||||
incoming: &types.Issue{
|
||||
ID: "bd-1",
|
||||
ID: testIssueBD1,
|
||||
Title: "Test",
|
||||
Description: "Test",
|
||||
Status: types.StatusOpen,
|
||||
@@ -710,7 +712,7 @@ func TestCountReferencesWordBoundary(t *testing.T) {
|
||||
// Adjust expected based on actual counting logic
|
||||
// countReferences skips the issue itself
|
||||
expected := tt.expectedCount
|
||||
if tt.issueID == "bd-1" {
|
||||
if tt.issueID == testIssueBD1 {
|
||||
expected = 1 // only bd-10's description
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const testUserAlice = "alice"
|
||||
|
||||
func TestAddComment(t *testing.T) {
|
||||
store, cleanup := setupTestDB(t)
|
||||
defer cleanup()
|
||||
@@ -26,7 +28,7 @@ func TestAddComment(t *testing.T) {
|
||||
}
|
||||
|
||||
// Add a comment
|
||||
err = store.AddComment(ctx, issue.ID, "alice", "This is a test comment")
|
||||
err = store.AddComment(ctx, issue.ID, testUserAlice, "This is a test comment")
|
||||
if err != nil {
|
||||
t.Fatalf("AddComment failed: %v", err)
|
||||
}
|
||||
@@ -55,7 +57,7 @@ func TestAddComment(t *testing.T) {
|
||||
t.Fatal("Comment event not found")
|
||||
}
|
||||
|
||||
if commentEvent.Actor != "alice" {
|
||||
if commentEvent.Actor != testUserAlice {
|
||||
t.Errorf("Expected actor 'alice', got '%s'", commentEvent.Actor)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
const testIssueCustom1 = "custom-1"
|
||||
|
||||
// TestLazyCounterInitialization verifies that counters are initialized lazily
|
||||
// on first use, not by scanning the entire database on every CreateIssue
|
||||
func TestLazyCounterInitialization(t *testing.T) {
|
||||
@@ -163,7 +165,7 @@ func TestLazyCounterInitializationMultiplePrefix(t *testing.T) {
|
||||
t.Fatalf("CreateIssue failed: %v", err)
|
||||
}
|
||||
|
||||
if customIssue.ID != "custom-1" {
|
||||
if customIssue.ID != testIssueCustom1 {
|
||||
t.Errorf("Expected custom-1, got %s", customIssue.ID)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user