This commit is contained in:
@@ -17,8 +17,8 @@ func pageVersion(t *testing.T, c apiClient, id string) int {
|
||||
|
||||
func TestPageHierarchy(t *testing.T) {
|
||||
srv := testServer(t)
|
||||
alice := newAPIUser(t, srv, "pages-tree@computer.test")
|
||||
bob := newAPIUser(t, srv, "pages-tree-other@computer.test")
|
||||
alice := newAPIUser(t, srv, "pages-tree@superbrain.test")
|
||||
bob := newAPIUser(t, srv, "pages-tree-other@superbrain.test")
|
||||
|
||||
root := alice.request("POST", "/api/pages", map[string]any{"title": "Root"}, 201)["id"].(string)
|
||||
child := alice.request("POST", "/api/pages", map[string]any{"title": "Child", "parentId": root}, 201)["id"].(string)
|
||||
@@ -71,8 +71,8 @@ func TestPageHierarchy(t *testing.T) {
|
||||
|
||||
func TestPageBacklinksAndEmbeds(t *testing.T) {
|
||||
srv := testServer(t)
|
||||
alice := newAPIUser(t, srv, "pages-graph@computer.test")
|
||||
bob := newAPIUser(t, srv, "pages-graph-other@computer.test")
|
||||
alice := newAPIUser(t, srv, "pages-graph@superbrain.test")
|
||||
bob := newAPIUser(t, srv, "pages-graph-other@superbrain.test")
|
||||
|
||||
target := alice.request("POST", "/api/pages", map[string]any{"title": "Target page"}, 201)["id"].(string)
|
||||
bobTarget := bob.request("POST", "/api/pages", map[string]any{"title": "Private title"}, 201)["id"].(string)
|
||||
@@ -82,9 +82,9 @@ func TestPageBacklinksAndEmbeds(t *testing.T) {
|
||||
foreignCollection := bob.request("POST", "/api/collections", map[string]any{"name": "Bob private"}, 201)["id"].(string)
|
||||
|
||||
content := "# Connected\n\n" +
|
||||
"- [Target](computer:page/" + target + ")\n" +
|
||||
"- [Target](superbrain:page/" + target + ")\n" +
|
||||
"- [Alias](/pages?id=" + target + ")\n" +
|
||||
"- [Bob's page](computer:page/" + bobTarget + ")\n\n" +
|
||||
"- [Bob's page](superbrain:page/" + bobTarget + ")\n\n" +
|
||||
"{{collection:" + collection + "|view=" + view + "}}\n" +
|
||||
"{{collection:" + foreignCollection + "}}\n"
|
||||
source := alice.request("POST", "/api/pages", map[string]any{"title": "Source page", "content": content}, 201)["id"].(string)
|
||||
@@ -140,7 +140,7 @@ func TestPageBacklinksAndEmbeds(t *testing.T) {
|
||||
|
||||
// Re-linking re-establishes the edge; deleting the target removes it.
|
||||
alice.request("PATCH", "/api/pages/"+source, map[string]any{
|
||||
"content": "[Target](computer:page/" + target + ")", "version": pageVersion(t, alice, source),
|
||||
"content": "[Target](superbrain:page/" + target + ")", "version": pageVersion(t, alice, source),
|
||||
}, 200)
|
||||
if b := alice.request("GET", "/api/pages/"+target, nil, 200)["backlinks"].([]any); len(b) != 1 {
|
||||
t.Fatalf("re-link was not resolved: %v", b)
|
||||
@@ -151,7 +151,7 @@ func TestPageBacklinksAndEmbeds(t *testing.T) {
|
||||
}
|
||||
|
||||
// Self-links are ignored (a page is not its own backlink).
|
||||
selfContent := "[Me](computer:page/" + source + ")"
|
||||
selfContent := "[Me](superbrain:page/" + source + ")"
|
||||
alice.request("PATCH", "/api/pages/"+source, map[string]any{
|
||||
"content": selfContent, "version": pageVersion(t, alice, source),
|
||||
}, 200)
|
||||
|
||||
Reference in New Issue
Block a user