diff options
author | Chris <ccbrown112@gmail.com> | 2017-07-24 11:55:37 -0700 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-07-24 14:55:37 -0400 |
commit | 345dd400bbe2f41c45b08dc06e3199c900361fff (patch) | |
tree | 14ab3744411154dc244537e3125fcab1758f03de /app/command_code_test.go | |
parent | 72355ba2bf566b538675d27a8611eb67d4f43bdd (diff) | |
download | chat-345dd400bbe2f41c45b08dc06e3199c900361fff.tar.gz chat-345dd400bbe2f41c45b08dc06e3199c900361fff.tar.bz2 chat-345dd400bbe2f41c45b08dc06e3199c900361fff.zip |
PLT-6706: add /code command (#6936)
* add /code command
* return an error for empty /code message
Diffstat (limited to 'app/command_code_test.go')
-rw-r--r-- | app/command_code_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/command_code_test.go b/app/command_code_test.go new file mode 100644 index 000000000..7b5813a62 --- /dev/null +++ b/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) + } + } +} |