Fixing unit tests
Этот коммит содержится в:
@@ -33,15 +33,6 @@ func GetCommandProvidersProvider(name string) CommandProvider {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// cmds = map[string]string{
|
|
||||||
// "logoutCommand": "/logout",
|
|
||||||
// "joinCommand": "/join",
|
|
||||||
// "loadTestCommand": "/loadtest",
|
|
||||||
// "echoCommand": "/echo",
|
|
||||||
// "shrugCommand": "/shrug",
|
|
||||||
// "meCommand": "/me",
|
|
||||||
// }
|
|
||||||
|
|
||||||
func InitCommand(r *mux.Router) {
|
func InitCommand(r *mux.Router) {
|
||||||
l4g.Debug("Initializing command api routes")
|
l4g.Debug("Initializing command api routes")
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,10 @@ func (me *ShrugProvider) GetCommand() *model.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (me *ShrugProvider) DoCommand(c *Context, channelId string, message string) *model.CommandResponse {
|
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}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func TestShrugCommand(t *testing.T) {
|
|||||||
if len(p1.Order) != 1 {
|
if len(p1.Order) != 1 {
|
||||||
t.Fatal("Command failed to send")
|
t.Fatal("Command failed to send")
|
||||||
} else {
|
} else {
|
||||||
if p1.Posts[p1.Order[0]].Message != `¯\_(ツ)_/¯` {
|
if p1.Posts[p1.Order[0]].Message != `¯\\\_(ツ)\_/¯` {
|
||||||
t.Log(p1.Posts[p1.Order[0]].Message)
|
t.Log(p1.Posts[p1.Order[0]].Message)
|
||||||
t.Fatal("invalid shrug reponse")
|
t.Fatal("invalid shrug reponse")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ export function listCommands(success, error) {
|
|||||||
url: '/api/v1/commands/list',
|
url: '/api/v1/commands/list',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'POST',
|
type: 'GET',
|
||||||
success,
|
success,
|
||||||
error: function onError(xhr, status, err) {
|
error: function onError(xhr, status, err) {
|
||||||
var e = handleError('listCommands', xhr, status, err);
|
var e = handleError('listCommands', xhr, status, err);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user