mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 15:02:43 +00:00
Slack webhook channel name cannot be empty or just contain an hashtag (#4786)
This commit is contained in:
parent
6e03390aa8
commit
be48397945
6 changed files with 69 additions and 5 deletions
|
@ -15,3 +15,20 @@ func TestRemoveUsernameParameterSuffix(t *testing.T) {
|
|||
assert.Equal(t, "foobar", RemoveUsernameParameterSuffix("foobar"))
|
||||
assert.Equal(t, "", RemoveUsernameParameterSuffix(""))
|
||||
}
|
||||
|
||||
func TestIsValidSlackChannel(t *testing.T) {
|
||||
tt := []struct {
|
||||
channelName string
|
||||
expected bool
|
||||
}{
|
||||
{"gitea", true},
|
||||
{" ", false},
|
||||
{"#", false},
|
||||
{"gitea ", true},
|
||||
{" gitea", true},
|
||||
}
|
||||
|
||||
for _, v := range tt {
|
||||
assert.Equal(t, v.expected, IsValidSlackChannel(v.channelName))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue