feat: slug on the post author object, for author links that do not expose the login
This commit is contained in:
@@ -293,8 +293,16 @@ func TestJournalAuthorPosts(t *testing.T) {
|
||||
t.Fatalf("author row keys = %v, want /posts row keys %v", got, want)
|
||||
}
|
||||
author, _ := page.Data[0]["author"].(map[string]any)
|
||||
if author == nil || author["login"] != "jdoe" {
|
||||
t.Fatalf("row author = %v, want login jdoe", page.Data[0]["author"])
|
||||
if author == nil || author["login"] != "jdoe" || author["slug"] != "jane-doe" {
|
||||
t.Fatalf("row author = %v, want login jdoe and slug jane-doe", page.Data[0]["author"])
|
||||
}
|
||||
// Without an author slug, the row's slug is the login.
|
||||
for _, row := range all.Data {
|
||||
if row["slug"] == "b1" {
|
||||
if a, _ := row["author"].(map[string]any); a == nil || a["slug"] != "bob" {
|
||||
t.Fatalf("b1 author = %v, want slug bob", row["author"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
page = getAuthorPosts(t, env, base+"?per_page=2&page=2", "")
|
||||
|
||||
Reference in New Issue
Block a user