Refactor integration test DecodeJSON calls to use generic return value (#37432)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Copilot
2026-04-26 14:57:07 +00:00
committed by GitHub
parent 99cd4f6b22
commit 2671b997f2
105 changed files with 569 additions and 930 deletions
+2 -3
View File
@@ -53,7 +53,7 @@ func TestAPIGetRequestedFiles(t *testing.T) {
if resp.Code != http.StatusOK {
return nil
}
DecodeJSON(t, resp, &ret)
ret = DecodeJSON(t, resp, []*api.ContentsResponse{})
return ret
}
@@ -62,8 +62,7 @@ func TestAPIGetRequestedFiles(t *testing.T) {
reqBodyParam, _ := json.Marshal(reqBodyOpt)
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/file-contents?body="+url.QueryEscape(string(reqBodyParam)))
resp := MakeRequest(t, req, http.StatusOK)
var ret []*api.ContentsResponse
DecodeJSON(t, resp, &ret)
ret := DecodeJSON(t, resp, []*api.ContentsResponse{})
expected := []*api.ContentsResponse{getExpectedContentsResponseForContents(repo1.DefaultBranch, "branch", lastCommit.ID.String())}
assert.Equal(t, expected, ret)
})