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 -4
View File
@@ -5,7 +5,6 @@ import (
"encoding/json"
"net/http"
"strconv"
"strings"
"testing"
)
@@ -121,7 +120,7 @@ func TestSitesMediaUsage(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 := newSiteEnvWithShop(t)
e.seedBanner(5, "banner.png", "hash")
e.useImageOnSite(siteShopID, 5)
@@ -129,8 +128,13 @@ func TestSitesMediaUsage(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(), "site") {
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)
}
})
}