mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-19 17:03:59 +08:00

Works in both organization and repository project boards Fixes #21846 Replaces #21963 Replaces #27117  **Note** that implementation was made intentionally to work same as in issue list so that URL can be bookmarked for quick access with predefined filters in URL
27 lines
647 B
Go
27 lines
647 B
Go
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package user
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/models/user"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMakeSelfOnTop(t *testing.T) {
|
|
users := MakeSelfOnTop(nil, []*user.User{{ID: 2}, {ID: 1}})
|
|
assert.Len(t, users, 2)
|
|
assert.EqualValues(t, 2, users[0].ID)
|
|
|
|
users = MakeSelfOnTop(&user.User{ID: 1}, []*user.User{{ID: 2}, {ID: 1}})
|
|
assert.Len(t, users, 2)
|
|
assert.EqualValues(t, 1, users[0].ID)
|
|
|
|
users = MakeSelfOnTop(&user.User{ID: 2}, []*user.User{{ID: 2}, {ID: 1}})
|
|
assert.Len(t, users, 2)
|
|
assert.EqualValues(t, 2, users[0].ID)
|
|
}
|