* add /code command

* return an error for empty /code message
Этот коммит содержится в:
Chris
2017-07-24 11:55:37 -07:00
коммит произвёл enahum
родитель 72355ba2bf
Коммит 345dd400bb
3 изменённых файлов: 86 добавлений и 0 удалений

26
app/command_code_test.go Обычный файл
Просмотреть файл

@@ -0,0 +1,26 @@
package app
import (
"testing"
"github.com/mattermost/platform/model"
)
func TestCodeProviderDoCommand(t *testing.T) {
cp := CodeProvider{}
args := &model.CommandArgs{
T: func(s string, args ...interface{}) string { return s },
}
for msg, expected := range map[string]string{
"": "api.command_code.message.app_error",
"foo": " foo",
"foo\nbar": " foo\n bar",
"foo\nbar\n": " foo\n bar\n ",
} {
actual := cp.DoCommand(args, msg).Text
if actual != expected {
t.Errorf("expected `%v`, got `%v`", expected, actual)
}
}
}