refactor: complete refactor and better helpers use

This commit is contained in:
2025-11-29 15:19:41 +01:00
parent 7d46d3e81b
commit d4e91b6034
10 changed files with 212 additions and 389 deletions

View File

@@ -290,10 +290,10 @@ func TestIntegration_CompleteAPIEndpoints(t *testing.T) {
}
}
rec2 := makeGetRequest(t, ctx.Router, "/api/posts/search?q=Searchable&limit=1&offset=1")
secondRequest := makeGetRequest(t, ctx.Router, "/api/posts/search?q=Searchable&limit=1&offset=1")
response2 := assertJSONResponse(t, rec2, http.StatusOK)
if data, ok := getDataFromResponse(response2); ok {
secondResponse := assertJSONResponse(t, secondRequest, http.StatusOK)
if data, ok := getDataFromResponse(secondResponse); ok {
if posts, ok := data["posts"].([]any); ok {
if len(posts) > 1 {
t.Errorf("Expected at most 1 post with limit=1 and offset=1, got %d", len(posts))