-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbot_test.go
More file actions
29 lines (25 loc) · 781 Bytes
/
bot_test.go
File metadata and controls
29 lines (25 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package slackbot
import (
"testing"
)
func TestHelp(t *testing.T) {
bot, err := NewTestBot()
if err != nil {
t.Fatal(err)
}
bot.AddCommand("date", NewExecCommand("/bin/date", nil, true, "Show the current date", &config{}))
bot.AddCommand("utc", NewExecCommand("/bin/date", []string{"-u"}, true, "Show the current date (utc)", &config{}))
msg := bot.HelpMessage()
if msg == "" {
t.Fatal("No help message")
}
t.Logf("Help:\n%s", msg)
}
func TestParseInput(t *testing.T) {
args := parseInput(`!keybot dumplog "release promote"`)
if args[0] != "!keybot" || args[1] != "dumplog" || args[2] != `release promote` {
t.Fatal("Invalid parse")
}
}