Files
superbrain/internal/markdown/markdown_test.go
T
Andrew S Erwin 5684757d24 Rename Go module to gitea.federated.computer/Federated_Computer/brain
The module path claimed a nonexistent GitHub repo. Point it (and the
agent User-Agent contact URL, README/RUNNING clone URLs) at the real
Gitea repository. Pure identifier rename: no runtime behavior change.

Verified: build, vet, unit + full DB integration (-race), db-converge,
web lint/SSR/build, browser regressions, e2e against rebuilt stack.
2026-11-22 02:46:40 -06:00

28 lines
698 B
Go

package markdown
import (
"strings"
"testing"
"gitea.federated.computer/Federated_Computer/brain/internal/db"
)
// Review L-11: link destinations are wrapped and escaped so parentheses or
// angle brackets in a bookmark URL cannot terminate or extend the link.
func TestPageDocumentEscapesLinkDestinations(t *testing.T) {
out := PageDocument(db.Object{
"title": "Links",
"content": "",
"bookmarks": []any{
map[string]any{"bookmark": map[string]any{
"title": "Odd",
"url": "https://example.com/a(b)?x=<y>",
}},
},
})
want := "[Odd](<https://example.com/a(b)?x=%3Cy%3E>)"
if !strings.Contains(out, want) {
t.Fatalf("link destination not escaped:\n%s", out)
}
}