diff options
Diffstat (limited to 'routers/utils/utils_test.go')
-rw-r--r-- | routers/utils/utils_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/routers/utils/utils_test.go b/routers/utils/utils_test.go index fb56ac85c2..d96e1d7d26 100644 --- a/routers/utils/utils_test.go +++ b/routers/utils/utils_test.go @@ -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)) + } +} |