feat: SEO backend data (1/4)

This commit is contained in:
Florian Sylvain committed 2026-10-15 19:30:29 +02:00
1 parent cb1410f0b0
commit 0eb46b0d74
90 files changed
+6094 -350

No files matched your search

+8 -3
View File
@@ -523,7 +523,7 @@ func TestAuthorsBackendMediaUsage(t *testing.T) {
}
})
t.Run("The usage lookup array shape is unchanged", func(t *testing.T) {
t.Run("The usage lookup stays an array and later gains additive keys", func(t *testing.T) {
e := newAuthorEnv(t)
e.seedBanner(5, "banner.png", "hash")
e.authors.seed(2, "Camille", "camille")
@@ -532,8 +532,13 @@ func TestAuthorsBackendMediaUsage(t *testing.T) {
rec := e.owner(t, http.MethodGet, "/v1/media/5/usage", "")
if rec.Code != http.StatusOK || !strings.HasPrefix(rec.Body.String(), `[{"id":1,"title":`) || strings.Contains(rec.Body.String(), "author") {
t.Errorf("status %d body %s", rec.Code, rec.Body.String())
var items []map[string]any
if err := json.Unmarshal(rec.Body.Bytes(), &items); err != nil || rec.Code != http.StatusOK || len(items) != 2 {
t.Fatalf("status %d body %s", rec.Code, rec.Body.String())
}
first := items[0]
if first["id"] != float64(1) || first["title"] != "Spring release" || first["published"] != true || first["type"] != "article" {
t.Errorf("the article item lost a key: %v", first)
}
})
}