Files
superbrain/internal/markdown/markdown_test.go
T
Andrew S Erwin 4b6a58118e Rename Go module to gitea.federated.computer/Federated_Computer/superbrain
The Gitea repository was renamed brain -> superbrain (server-side redirect
already in place; local origin updated at 0.3.5). Carry the rename through
for accurate identity, the 0.3.2 precedent: go.mod + every internal import,
the agent's outbound User-Agent contact URL, README/RUNNING clone URLs and
local notes. CHANGELOG history entries stay as written. Pure identifier
rename, no runtime behavior change; verified with build + vet + unit tests
and the full database integration suite under -race.
2026-11-24 16:02:01 -06:00

28 lines
703 B
Go

package markdown
import (
"strings"
"testing"
"gitea.federated.computer/Federated_Computer/superbrain/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)
}
}