beads/cmd/bd/dep_batch_test.go
Julian Knutsen dc39fdc128
feat: support batch dep list for multiple issue IDs (#2875)
`bd dep list` now accepts multiple issue IDs. When all IDs route to
the same store and direction is "down", uses the existing
GetDependencyRecordsForIssues batch query (single SQL call with IN
clause) instead of N individual queries.

This enables callers like Gas City's workflow snapshot to fetch deps
for all workflow beads in one subprocess call instead of N+1.

Examples:
  bd dep list ga-1 ga-2 ga-3              # batch deps
  bd dep list ga-1 ga-2 --json            # batch JSON output
  bd dep list ga-1                        # single ID (unchanged)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 14:32:58 -07:00

27 lines
682 B
Go

package main
import (
"testing"
)
func TestDepListAcceptsMultipleArgs(t *testing.T) {
// Verify the cobra command accepts multiple args (MinimumNArgs(1)).
cmd := depListCmd
if err := cmd.Args(cmd, []string{"id1", "id2", "id3"}); err != nil {
t.Fatalf("depListCmd should accept multiple args: %v", err)
}
}
func TestDepListRequiresAtLeastOneArg(t *testing.T) {
cmd := depListCmd
if err := cmd.Args(cmd, []string{}); err == nil {
t.Fatal("depListCmd should reject zero args")
}
}
func TestDepListAcceptsSingleArg(t *testing.T) {
cmd := depListCmd
if err := cmd.Args(cmd, []string{"id1"}); err != nil {
t.Fatalf("depListCmd should accept single arg: %v", err)
}
}