chore: sort blocked users list for determistic results (#8320)
Some checks are pending
/ release (push) Waiting to run
testing-integration / test-unit (push) Has been skipped
testing-integration / test-sqlite (push) Has been skipped
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped

- 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:
Gusted 2025-06-27 17:37:29 +02:00 committed by Earl Warren
parent 69d374435b
commit 6b27fa66b9

View file

@ -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)
})