-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathirc_test.go
More file actions
71 lines (66 loc) · 1.9 KB
/
Copy pathirc_test.go
File metadata and controls
71 lines (66 loc) · 1.9 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package irc
import (
"testing"
"time"
"github.com/lrstanley/girc"
"github.com/ritlug/teleirc/internal"
"github.com/stretchr/testify/assert"
)
func TestNewClientBasic(t *testing.T) {
ircSettings := &internal.IRCSettings{
Server: "irc.batcave.intl",
Port: 1337,
BotIdent: "alfred",
BotName: "Alfred Pennyworth",
BotNick: "alfred-p",
}
logger := internal.Debug{
DebugLevel: false,
}
client := NewClient(ircSettings, nil, logger)
expectedConfig := girc.Config{
Server: "irc.batcave.intl",
Port: 1337,
Nick: "alfred-p",
Name: "Alfred Pennyworth",
User: "alfred",
PingDelay: 20 * time.Second,
PingTimeout: time.Minute,
}
assert.Equal(t, client.Settings, ircSettings, "Client settings should be properly set")
assert.Equal(t, client.Config, expectedConfig, "girc config should be properly set")
}
func TestNewClientFull(t *testing.T) {
ircSettings := &internal.IRCSettings{
BindAddress: "129.21.13.37",
Server: "irc.batcave.intl",
ServerPass: "BatmanNeverDies!",
Port: 1337,
BotIdent: "alfred",
BotName: "Alfred Pennyworth",
BotNick: "alfred-p",
NickServUser: "irc_moderators",
NickServPassword: "ProtectGotham",
}
logger := internal.Debug{
DebugLevel: false,
}
client := NewClient(ircSettings, nil, logger)
expectedConfig := girc.Config{
Bind: "129.21.13.37",
Server: "irc.batcave.intl",
ServerPass: "BatmanNeverDies!",
Port: 1337,
Nick: "alfred-p",
Name: "Alfred Pennyworth",
User: "alfred",
PingDelay: 20 * time.Second,
PingTimeout: time.Minute,
SASL: &girc.SASLPlain{
User: "irc_moderators",
Pass: "ProtectGotham",
},
}
assert.Equal(t, client.Settings, ircSettings, "Client settings should be properly set")
assert.Equal(t, client.Config, expectedConfig, "girc config should be properly set")
}