forked from forgejo/forgejo
Implement "conversation lock" for issue comments (#5073)
This commit is contained in:
parent
64ce159a6e
commit
44114b38e6
19 changed files with 435 additions and 4 deletions
|
@ -7,6 +7,7 @@ package auth
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -39,3 +40,27 @@ func TestSubmitReviewForm_IsEmpty(t *testing.T) {
|
|||
assert.Equal(t, v.expected, v.form.HasEmptyContent())
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueLock_HasValidReason(t *testing.T) {
|
||||
|
||||
// Init settings
|
||||
_ = setting.Repository
|
||||
|
||||
cases := []struct {
|
||||
form IssueLockForm
|
||||
expected bool
|
||||
}{
|
||||
{IssueLockForm{""}, true}, // an empty reason is accepted
|
||||
{IssueLockForm{"Off-topic"}, true},
|
||||
{IssueLockForm{"Too heated"}, true},
|
||||
{IssueLockForm{"Spam"}, true},
|
||||
{IssueLockForm{"Resolved"}, true},
|
||||
|
||||
{IssueLockForm{"ZZZZ"}, false},
|
||||
{IssueLockForm{"I want to lock this issue"}, false},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
assert.Equal(t, v.expected, v.form.HasValidReason())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue