test: improve coverage for importer and sqlite utils

- Fix TestImportIssues_Update by adding timestamps to test issue
- Add comprehensive tests for sqlite utility functions (IsUniqueConstraintError, QueryContext, BeginTx, ExecInTransaction)
- Coverage improvements: sqlite util.go 0% -> 95%, sqlite package 56.4% -> 57.1%

Amp-Thread-ID: https://ampcode.com/threads/T-17e6a3e4-f881-4f53-b670-bdd796d58f68
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-01 11:35:25 -07:00
parent 48469585b4
commit a4b4778ced
2 changed files with 166 additions and 1 deletions

View File

@@ -620,7 +620,7 @@ func TestImportIssues_Update(t *testing.T) {
t.Fatalf("Failed to create initial issue: %v", err)
}
// Import updated version
// Import updated version with newer timestamp
issue2 := &types.Issue{
ID: "test-abc123",
Title: "Updated Title",
@@ -628,7 +628,10 @@ func TestImportIssues_Update(t *testing.T) {
Status: types.StatusInProgress,
Priority: 2,
IssueType: types.TypeTask,
CreatedAt: time.Now(),
UpdatedAt: time.Now().Add(time.Hour), // Newer than issue1
}
issue2.ContentHash = issue2.ComputeContentHash()
result, err := ImportIssues(ctx, tmpDB, store, []*types.Issue{issue2}, Options{})
if err != nil {