1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-10-15 19:42:04 +00:00

Convert anonymous structs in ViewResponse into named structs for unit testing

This commit is contained in:
Mathieu Fenniak 2025-08-26 21:29:12 -06:00
parent 13142acf60
commit cb17e7542c

View file

@ -112,29 +112,37 @@ type ViewRequest struct {
} }
type ViewResponse struct { type ViewResponse struct {
State struct { State ViewState `json:"state"`
Run struct { Logs ViewLogs `json:"logs"`
Link string `json:"link"` }
Title string `json:"title"`
TitleHTML template.HTML `json:"titleHTML"` type ViewState struct {
Status string `json:"status"` Run ViewRunInfo `json:"run"`
CanCancel bool `json:"canCancel"` CurrentJob ViewCurrentJob `json:"currentJob"`
CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve }
CanRerun bool `json:"canRerun"`
CanDeleteArtifact bool `json:"canDeleteArtifact"` type ViewRunInfo struct {
Done bool `json:"done"` Link string `json:"link"`
Jobs []*ViewJob `json:"jobs"` Title string `json:"title"`
Commit ViewCommit `json:"commit"` TitleHTML template.HTML `json:"titleHTML"`
} `json:"run"` Status string `json:"status"`
CurrentJob struct { CanCancel bool `json:"canCancel"`
Title string `json:"title"` CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve
Detail string `json:"detail"` CanRerun bool `json:"canRerun"`
Steps []*ViewJobStep `json:"steps"` CanDeleteArtifact bool `json:"canDeleteArtifact"`
} `json:"currentJob"` Done bool `json:"done"`
} `json:"state"` Jobs []*ViewJob `json:"jobs"`
Logs struct { Commit ViewCommit `json:"commit"`
StepsLog []*ViewStepLog `json:"stepsLog"` }
} `json:"logs"`
type ViewCurrentJob struct {
Title string `json:"title"`
Detail string `json:"detail"`
Steps []*ViewJobStep `json:"steps"`
}
type ViewLogs struct {
StepsLog []*ViewStepLog `json:"stepsLog"`
} }
type ViewJob struct { type ViewJob struct {