forked from go-chat-bot/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtreta_test.go
55 lines (42 loc) · 1.13 KB
/
treta_test.go
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package treta
import (
"testing"
"github.com/meleca/bot"
. "github.com/smartystreets/goconvey/convey"
)
func TestTreta(t *testing.T) {
Convey("treta", t, func() {
bot := &bot.Cmd{
Command: "treta",
}
Convey("Should return a random treta", func() {
got, error := treta(bot)
So(error, ShouldBeNil)
So(got, ShouldNotBeBlank)
})
Convey("Should return a VIM treta", func() {
bot.Args = []string{"vim"}
got, error := treta(bot)
So(error, ShouldBeNil)
So(quotes["VIM"], ShouldContain, got)
})
Convey("Should return a Ruby treta", func() {
bot.Args = []string{"ruby"}
got, error := treta(bot)
So(error, ShouldBeNil)
So(quotes["RUBY"], ShouldContain, got)
})
Convey("Should return a error message when pass a invalid param", func() {
bot.Args = []string{"kkk"}
got, error := treta(bot)
So(error, ShouldBeNil)
So(got, ShouldEqual, msgInvalidParam)
})
Convey("Should return a error message when pass a invalid amount of params", func() {
bot.Args = []string{"1", "2"}
got, error := treta(bot)
So(error, ShouldBeNil)
So(got, ShouldEqual, msgInvalidAmountOfParams)
})
})
}