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>
86 lines
2.2 KiB
Go
86 lines
2.2 KiB
Go
package tracker
|
|
|
|
import "testing"
|
|
|
|
func TestParseCommaSeparated(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
want []string
|
|
}{
|
|
{"single", "abc", []string{"abc"}},
|
|
{"two", "abc,def", []string{"abc", "def"}},
|
|
{"whitespace", " abc , def , ghi ", []string{"abc", "def", "ghi"}},
|
|
{"empty elements", "abc,,def,", []string{"abc", "def"}},
|
|
{"empty string", "", []string{}},
|
|
{"only commas", ",,,", []string{}},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := ParseCommaSeparated(tt.input)
|
|
if len(got) != len(tt.want) {
|
|
t.Fatalf("ParseCommaSeparated(%q) = %v, want %v", tt.input, got, tt.want)
|
|
}
|
|
for i := range got {
|
|
if got[i] != tt.want[i] {
|
|
t.Errorf("[%d] = %q, want %q", i, got[i], tt.want[i])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestDeduplicateStrings(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input []string
|
|
want []string
|
|
}{
|
|
{"no dupes", []string{"a", "b", "c"}, []string{"a", "b", "c"}},
|
|
{"with dupes", []string{"a", "b", "a", "c", "b"}, []string{"a", "b", "c"}},
|
|
{"all same", []string{"x", "x", "x"}, []string{"x"}},
|
|
{"empty", []string{}, []string{}},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := DeduplicateStrings(tt.input)
|
|
if len(got) != len(tt.want) {
|
|
t.Fatalf("DeduplicateStrings(%v) = %v, want %v", tt.input, got, tt.want)
|
|
}
|
|
for i := range got {
|
|
if got[i] != tt.want[i] {
|
|
t.Errorf("[%d] = %q, want %q", i, got[i], tt.want[i])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestResolveProjectIDs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
cli []string
|
|
plural string
|
|
singular string
|
|
wantLen int
|
|
wantFirst string
|
|
}{
|
|
{"cli override", []string{"X", "Y"}, "A,B", "C", 2, "X"},
|
|
{"plural config", nil, "A, B, C", "D", 3, "A"},
|
|
{"singular fallback", nil, "", "D", 1, "D"},
|
|
{"nothing", nil, "", "", 0, ""},
|
|
{"cli dedup", []string{"A", "B", "A"}, "", "", 2, "A"},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := ResolveProjectIDs(tt.cli, tt.plural, tt.singular)
|
|
if len(got) != tt.wantLen {
|
|
t.Fatalf("got %v (len %d), want len %d", got, len(got), tt.wantLen)
|
|
}
|
|
if tt.wantLen > 0 && got[0] != tt.wantFirst {
|
|
t.Errorf("first = %q, want %q", got[0], tt.wantFirst)
|
|
}
|
|
})
|
|
}
|
|
}
|