summaryrefslogtreecommitdiffstats
path: root/app/command_code_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/command_code_test.go')
-rw-r--r--app/command_code_test.go26
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)
+ }
+ }
+}