mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-02 16:35:19 +02:00
chore: sort blocked users list for determistic results (#8320)
- Ref https://codeberg.org/forgejo/forgejo/issues/8221#issuecomment-5515478 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8320 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
69d374435b
commit
6b27fa66b9
1 changed files with 3 additions and 0 deletions
|
@ -4,8 +4,10 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
auth_model "forgejo.org/models/auth"
|
||||
|
@ -46,6 +48,7 @@ func TestAPIUserBlock(t *testing.T) {
|
|||
var blockedUsers []api.BlockedUser
|
||||
DecodeJSON(t, resp, &blockedUsers)
|
||||
assert.Len(t, blockedUsers, 2)
|
||||
slices.SortFunc(blockedUsers, func(a, b api.BlockedUser) int { return cmp.Compare(a.BlockID, b.BlockID) })
|
||||
assert.EqualValues(t, 1, blockedUsers[0].BlockID)
|
||||
assert.EqualValues(t, 2, blockedUsers[1].BlockID)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue