feat: public API, SEO and existing surfaces
This commit is contained in:
1 parent
45fbbc33b1
commit
c390fcfe8d
103 files changed
+4476
-231
No files matched your search
@@ -737,7 +737,7 @@ func TestMediaUsage(t *testing.T) {
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("expected status 200, got %d", rec.Code)
|
||||
}
|
||||
want := `[{"type": "article", "id": 1, "title": "Kitchen Renovation", "published": true, "fields": ["body"]}, {"type": "article", "id": 2, "title": "Backyard Notes", "published": false, "fields": ["body"]}]`
|
||||
want := `[{"type": "article", "id": 1, "title": "Kitchen Renovation", "published": true, "fields": ["body"], "story_id": 0, "lang": ""}, {"type": "article", "id": 2, "title": "Backyard Notes", "published": false, "fields": ["body"], "story_id": 0, "lang": ""}]`
|
||||
expectJSONEqual(t, rec.Body.String(), want)
|
||||
})
|
||||
|
||||
@@ -806,6 +806,22 @@ func TestMediaUsage(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestMediaDetailRepositoryFailures(t *testing.T) {
|
||||
for _, method := range []string{"FindByBodyContaining", "FindByImage"} {
|
||||
t.Run(method+" failing is a generic 500", func(t *testing.T) {
|
||||
env := newMediaEnv(t)
|
||||
seedListingLibrary(env)
|
||||
env.articles.fail.failNext(method)
|
||||
|
||||
rec := env.send(t, http.MethodGet, "/v1/media/1", "", mediaVerifiedUserId)
|
||||
|
||||
if rec.Code != http.StatusInternalServerError {
|
||||
t.Errorf("expected status 500, got %d", rec.Code)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func expectJSONEqual(t *testing.T, got string, want string) {
|
||||
t.Helper()
|
||||
var gotValue, wantValue any
|
||||
|
||||
Reference in new issue
Block a user