beads/internal/storage/issueops/ready_work_test.go
matt wilkie 55a7a7e75d
fix: update gate_test.go for multi-rig removal and fix gofmt in issueops tests (#2907)
- gate_test.go: update TestCheckBeadGate_InvalidFormat and
  TestCheckBeadGate_RigNotFound to expect 'multi-rig routing removed'
  message matching current checkBeadGate implementation
- gate_test.go: remove unused 'os' import
- issueops test files: fix gofmt alignment (filters, helpers, ready_work)

Amp-Thread-ID: https://ampcode.com/threads/T-019d3b48-af7d-7121-a0ff-8840ccbdfc87

Co-authored-by: Amp <amp@ampcode.com>
2026-03-29 14:01:48 -07:00

58 lines
1.2 KiB
Go

package issueops
import (
"testing"
)
func TestBuildSQLInClause(t *testing.T) {
t.Parallel()
tests := []struct {
name string
ids []string
wantPlaceholders string
wantArgs []interface{}
}{
{
name: "single ID",
ids: []string{"42"},
wantPlaceholders: "?",
wantArgs: []interface{}{"42"},
},
{
name: "multiple IDs",
ids: []string{"1", "2", "3"},
wantPlaceholders: "?,?,?",
wantArgs: []interface{}{"1", "2", "3"},
},
{
name: "empty slice",
ids: []string{},
wantPlaceholders: "",
wantArgs: []interface{}{},
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
gotPlaceholders, gotArgs := buildSQLInClause(tt.ids)
if gotPlaceholders != tt.wantPlaceholders {
t.Errorf("placeholders = %q, want %q", gotPlaceholders, tt.wantPlaceholders)
}
if len(gotArgs) != len(tt.wantArgs) {
t.Fatalf("args length = %d, want %d", len(gotArgs), len(tt.wantArgs))
}
for i := range gotArgs {
if gotArgs[i] != tt.wantArgs[i] {
t.Errorf("args[%d] = %v, want %v", i, gotArgs[i], tt.wantArgs[i])
}
}
})
}
}