diff --git a/cmd/server/tests/media_item_isbn_test.go b/cmd/server/tests/media_item_isbn_test.go index 69c754c..b21a5ef 100644 --- a/cmd/server/tests/media_item_isbn_test.go +++ b/cmd/server/tests/media_item_isbn_test.go @@ -334,11 +334,12 @@ func TestMediaItemsPagination(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) - var response []map[string]interface{} + var response map[string]interface{} json.NewDecoder(resp.Body).Decode(&response) + data := response["data"].([]interface{}) // Should get 2 items - assert.Equal(t, 2, len(response)) + assert.Equal(t, 2, len(data)) }) t.Run("Pagination with offset", func(t *testing.T) { @@ -352,11 +353,12 @@ func TestMediaItemsPagination(t *testing.T) { assert.Equal(t, http.StatusOK, resp.StatusCode) - var response []map[string]interface{} + var response map[string]interface{} json.NewDecoder(resp.Body).Decode(&response) + data := response["data"].([]interface{}) // Should get 2 items starting from offset 2 - assert.Equal(t, 2, len(response)) + assert.Equal(t, 2, len(data)) }) t.Run("Negative limit should fail", func(t *testing.T) {