feat: sites and authors integration into existing screens (& formated all frontend files kinda accidentally)

This commit is contained in:
Florian Sylvain committed 2026-10-15 05:25:44 +02:00
1 parent 3d81d2c717
commit 6b8990c55e
239 files changed
+9194 -1354

No files matched your search

+16 -5
View File
@@ -420,7 +420,7 @@ func TestAuthorsBackendOwnAuthor(t *testing.T) {
rec := e.as(t, authorEditorID, http.MethodPost, "/v1/author/me", "")
body := decodeAuthorBody(t, rec)
if rec.Code != http.StatusCreated || body["name"] != c.name || body["slug"] != c.slug || body["user_id"] != float64(authorEditorID) || body["is_linked"] != true {
if rec.Code != http.StatusCreated || body["name"] != c.name || body["slug"] != c.slug || body["user_id"] != float64(authorEditorID) || body["is_linked"] != true || body["slug_adjusted"] != false {
t.Errorf("status %d body %v", rec.Code, body)
}
})
@@ -446,7 +446,7 @@ func TestAuthorsBackendOwnAuthor(t *testing.T) {
rec := e.as(t, authorEditorID, http.MethodPost, "/v1/author/me", "")
if body := decodeAuthorBody(t, rec); rec.Code != http.StatusCreated || body["slug"] != "marta-alves-3" {
if body := decodeAuthorBody(t, rec); rec.Code != http.StatusCreated || body["slug"] != "marta-alves-3" || body["slug_adjusted"] != true {
t.Errorf("status %d body %v", rec.Code, body)
}
})
@@ -459,9 +459,20 @@ func TestAuthorsBackendOwnAuthor(t *testing.T) {
rec := e.as(t, authorEditorID, http.MethodPost, "/v1/author/me", "")
slug, _ := decodeAuthorBody(t, rec)["slug"].(string)
if rec.Code != http.StatusCreated || utf8.RuneCountInString(slug) > 100 || !strings.HasSuffix(slug, "-2") {
t.Errorf("status %d slug %q", rec.Code, slug)
body := decodeAuthorBody(t, rec)
slug, _ := body["slug"].(string)
if rec.Code != http.StatusCreated || utf8.RuneCountInString(slug) > 100 || !strings.HasSuffix(slug, "-2") || body["slug_adjusted"] != true {
t.Errorf("status %d slug %q body %v", rec.Code, slug, body)
}
})
t.Run("Only the own-author creation carries slug_adjusted", func(t *testing.T) {
e := newAuthorEnv(t)
rec := e.as(t, apiKeyOwnerId, http.MethodPost, "/v1/author/", `{"name": "Camille Roche"}`)
if _, present := decodeAuthorBody(t, rec)["slug_adjusted"]; rec.Code != http.StatusCreated || present {
t.Errorf("status %d body %s", rec.Code, rec.Body.String())
}
})