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>
114 lines
2.4 KiB
Go
114 lines
2.4 KiB
Go
package notion
|
|
|
|
import "testing"
|
|
|
|
func TestCanonicalizeNotionExternalRef(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tests := []struct {
|
|
name string
|
|
ref string
|
|
want string
|
|
ok bool
|
|
}{
|
|
{
|
|
name: "canonical url",
|
|
ref: "https://www.notion.so/My-Page-0123456789abcdef0123456789abcdef?pvs=4",
|
|
want: "https://www.notion.so/0123456789abcdef0123456789abcdef",
|
|
ok: true,
|
|
},
|
|
{
|
|
name: "bare page id rejected",
|
|
ref: "0123456789abcdef0123456789abcdef",
|
|
ok: false,
|
|
},
|
|
{
|
|
name: "not notion",
|
|
ref: "https://example.com/item/1",
|
|
ok: false,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, ok := CanonicalizeNotionExternalRef(tt.ref)
|
|
if ok != tt.ok {
|
|
t.Fatalf("ok = %v, want %v", ok, tt.ok)
|
|
}
|
|
if got != tt.want {
|
|
t.Fatalf("got = %q, want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestExtractNotionIdentifier(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tests := []struct {
|
|
ref string
|
|
want string
|
|
}{
|
|
{
|
|
ref: "https://www.notion.so/My-Page-0123456789abcdef0123456789abcdef",
|
|
want: "01234567-89ab-cdef-0123-456789abcdef",
|
|
},
|
|
{
|
|
ref: "0123456789abcdef0123456789abcdef",
|
|
want: "01234567-89ab-cdef-0123-456789abcdef",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
if got := ExtractNotionIdentifier(tt.ref); got != tt.want {
|
|
t.Fatalf("ExtractNotionIdentifier(%q) = %q, want %q", tt.ref, got, tt.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestBuildNotionExternalRefPrefersURL(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
issue := &PulledIssue{
|
|
ExternalRef: "https://www.notion.so/Test-0123456789abcdef0123456789abcdef",
|
|
NotionPageID: "fedcba98-7654-3210-fedc-ba9876543210",
|
|
}
|
|
|
|
got := BuildNotionExternalRef(issue)
|
|
want := "https://www.notion.so/0123456789abcdef0123456789abcdef"
|
|
if got != want {
|
|
t.Fatalf("got = %q, want %q", got, want)
|
|
}
|
|
}
|
|
|
|
func TestCanonicalizeNotionPageURL(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
for _, tt := range []struct {
|
|
name string
|
|
ref string
|
|
want string
|
|
}{
|
|
{
|
|
name: "url",
|
|
ref: "https://www.notion.so/Test-0123456789abcdef0123456789abcdef",
|
|
want: "https://www.notion.so/0123456789abcdef0123456789abcdef",
|
|
},
|
|
{
|
|
name: "bare id",
|
|
ref: "01234567-89ab-cdef-0123-456789abcdef",
|
|
want: "https://www.notion.so/0123456789abcdef0123456789abcdef",
|
|
},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, ok := CanonicalizeNotionPageURL(tt.ref)
|
|
if !ok {
|
|
t.Fatal("expected ok, got false")
|
|
}
|
|
if got != tt.want {
|
|
t.Fatalf("got = %q, want %q", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|