mirror of
https://github.com/go-gitea/gitea
synced 2025-07-12 13:37:20 +00:00
Implement "conversation lock" for issue comments (#5073)
This commit is contained in:
@ -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())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user