gitgram/aitimemachine/beads/cmd/bd/sync_issues_flag_test.go
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

67 lines
1.5 KiB
Go

package main
import (
"testing"
"github.com/spf13/cobra"
)
// TestIssuesFlagRegistered verifies that --issues is registered on all tracker sync commands.
func TestIssuesFlagRegistered(t *testing.T) {
// Not parallel: accesses shared cobra command tree.
trackers := []struct {
name string
syncCmd *cobra.Command
}{
{"ado", adoSyncCmd},
{"jira", jiraSyncCmd},
{"linear", linearSyncCmd},
{"github", githubSyncCmd},
{"gitlab", gitlabSyncCmd},
{"notion", notionSyncCmd},
}
for _, tc := range trackers {
t.Run(tc.name, func(t *testing.T) {
flag := tc.syncCmd.Flags().Lookup("issues")
if flag == nil {
t.Fatalf("%s sync command missing --issues flag", tc.name)
}
if flag.DefValue != "" {
t.Errorf("%s --issues default = %q, want empty", tc.name, flag.DefValue)
}
})
}
}
// TestIssuesFlagParsing verifies that --issues parses comma-separated IDs correctly.
func TestIssuesFlagParsing(t *testing.T) {
t.Parallel()
tests := []struct {
input string
want []string
}{
{"bd-abc,bd-def", []string{"bd-abc", "bd-def"}},
{"bd-abc", []string{"bd-abc"}},
{" bd-abc , bd-def ", []string{"bd-abc", "bd-def"}},
{"", nil},
}
for _, tc := range tests {
t.Run(tc.input, func(t *testing.T) {
got := splitCSV(tc.input)
if len(got) != len(tc.want) {
t.Fatalf("splitCSV(%q) = %v (len %d), want %v (len %d)",
tc.input, got, len(got), tc.want, len(tc.want))
}
for i, v := range got {
if v != tc.want[i] {
t.Errorf("splitCSV(%q)[%d] = %q, want %q", tc.input, i, v, tc.want[i])
}
}
})
}
}