fix: Add recentupdated
as recognized sort option
- Add `recentupdated` to the `OrderByMap`. - Add integration testing for organization and user repository sorting. - Resolves #5612 - Regression from12e23ee199
where the `recentupdated` case was not added to the map, but was handled seperately as a fallback. The regression came into affect when5a0bc35799
also relied on this map but didn't handle the `recentupdated` case.
This commit is contained in:
parent
b76d7a2b2d
commit
df38c41c7a
6 changed files with 44 additions and 7 deletions
|
@ -819,3 +819,27 @@ func TestUserTOTPEnrolled(t *testing.T) {
|
|||
assert.True(t, called)
|
||||
})
|
||||
}
|
||||
|
||||
func TestUserRepos(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
cases := map[string][]string{
|
||||
"alphabetically": {"repo6", "repo7", "repo8"},
|
||||
"recentupdate": {"repo7", "repo8", "repo6"},
|
||||
"reversealphabetically": {"repo8", "repo7", "repo6"},
|
||||
}
|
||||
|
||||
session := loginUser(t, "user10")
|
||||
for sortBy, repos := range cases {
|
||||
req := NewRequest(t, "GET", "/user10?sort="+sortBy)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
sel := htmlDoc.doc.Find("a.name")
|
||||
assert.Len(t, repos, len(sel.Nodes))
|
||||
for i := 0; i < len(repos); i++ {
|
||||
assert.EqualValues(t, repos[i], strings.TrimSpace(sel.Eq(i).Text()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue