mirror of
https://github.com/go-gitea/gitea
synced 2024-12-03 23:17:58 +01:00
4ab6fc62d2
Works in both organization and repository project boards Fixes #21846 Replaces #21963 Replaces #27117 ![image](https://github.com/user-attachments/assets/1837ace8-3de2-444f-a153-e166bd0da2c0) **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
26 lines
647 B
Go
26 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)
|
|
}
|