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:
@@ -22,8 +22,7 @@ func TestAPIListGitignoresTemplates(t *testing.T) {
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// This tests if the API returns a list of strings
|
||||
var gitignoreList []string
|
||||
DecodeJSON(t, resp, &gitignoreList)
|
||||
DecodeJSON(t, resp, []string{})
|
||||
}
|
||||
|
||||
func TestAPIGetGitignoreTemplateInfo(t *testing.T) {
|
||||
@@ -41,8 +40,7 @@ func TestAPIGetGitignoreTemplateInfo(t *testing.T) {
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var templateInfo api.GitignoreTemplateInfo
|
||||
DecodeJSON(t, resp, &templateInfo)
|
||||
templateInfo := DecodeJSON(t, resp, &api.GitignoreTemplateInfo{})
|
||||
|
||||
// We get the text of the template here
|
||||
text, _ := options.Gitignore(templateName)
|
||||
|
||||
Reference in New Issue
Block a user