fix: job list response to avoid wrapped body. (#7050)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7050
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Jaime merino <cobak78@gmail.com>
Co-committed-by: Jaime merino <cobak78@gmail.com>
This commit is contained in:
Jaime merino 2025-02-24 18:14:12 +00:00 committed by Gusted
parent 768f5a9255
commit a4778fc970
6 changed files with 24 additions and 25 deletions

View file

@ -11,7 +11,7 @@ import (
actions_model "code.gitea.io/gitea/models/actions"
auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/routers/api/v1/shared"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@ -30,9 +30,9 @@ func TestAPISearchActionJobs_UserRunner(t *testing.T) {
AddTokenAuth(token)
res := MakeRequest(t, req, http.StatusOK)
var jobs shared.RunJobList
var jobs []*api.ActionRunJob
DecodeJSON(t, res, &jobs)
assert.Len(t, jobs.Body, 1)
assert.EqualValues(t, job.ID, jobs.Body[0].ID)
assert.Len(t, jobs, 1)
assert.EqualValues(t, job.ID, jobs[0].ID)
}