summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-09 09:22:14 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-09 09:22:14 -0600
commit3edcf960a0502fbeb3e4b46e87ecb958646eeb39 (patch)
treed8f39f96499de30052169ac2970b10a71be2602e
parentb1a7c1acf139efbb5312b4aa939bd94155e6a9e6 (diff)
downloadchat-3edcf960a0502fbeb3e4b46e87ecb958646eeb39.tar.gz
chat-3edcf960a0502fbeb3e4b46e87ecb958646eeb39.tar.bz2
chat-3edcf960a0502fbeb3e4b46e87ecb958646eeb39.zip
Fixing unit tests
-rw-r--r--api/command.go9
-rw-r--r--api/command_shrug.go7
-rw-r--r--api/command_shrug_test.go2
-rw-r--r--web/react/utils/client.jsx2
4 files changed, 8 insertions, 12 deletions
diff --git a/api/command.go b/api/command.go
index 1161cc81a..2147196fa 100644
--- a/api/command.go
+++ b/api/command.go
@@ -33,15 +33,6 @@ func GetCommandProvidersProvider(name string) CommandProvider {
return nil
}
-// cmds = map[string]string{
-// "logoutCommand": "/logout",
-// "joinCommand": "/join",
-// "loadTestCommand": "/loadtest",
-// "echoCommand": "/echo",
-// "shrugCommand": "/shrug",
-// "meCommand": "/me",
-// }
-
func InitCommand(r *mux.Router) {
l4g.Debug("Initializing command api routes")
diff --git a/api/command_shrug.go b/api/command_shrug.go
index e34f80110..c49bd46ae 100644
--- a/api/command_shrug.go
+++ b/api/command_shrug.go
@@ -25,5 +25,10 @@ func (me *ShrugProvider) GetCommand() *model.Command {
}
func (me *ShrugProvider) DoCommand(c *Context, channelId string, message string) *model.CommandResponse {
- return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL, Text: `¯\_(ツ)_/¯`}
+ rmsg := `¯\\\_(ツ)\_/¯`
+ if len(message) > 0 {
+ rmsg = message + " " + rmsg
+ }
+
+ return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_IN_CHANNEL, Text: rmsg}
}
diff --git a/api/command_shrug_test.go b/api/command_shrug_test.go
index 95ef9f115..92cecf664 100644
--- a/api/command_shrug_test.go
+++ b/api/command_shrug_test.go
@@ -39,7 +39,7 @@ func TestShrugCommand(t *testing.T) {
if len(p1.Order) != 1 {
t.Fatal("Command failed to send")
} else {
- if p1.Posts[p1.Order[0]].Message != `¯\_(ツ)_/¯` {
+ if p1.Posts[p1.Order[0]].Message != `¯\\\_(ツ)\_/¯` {
t.Log(p1.Posts[p1.Order[0]].Message)
t.Fatal("invalid shrug reponse")
}
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 56c8c4b3e..39629b529 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -857,7 +857,7 @@ export function listCommands(success, error) {
url: '/api/v1/commands/list',
dataType: 'json',
contentType: 'application/json',
- type: 'POST',
+ type: 'GET',
success,
error: function onError(xhr, status, err) {
var e = handleError('listCommands', xhr, status, err);