|
@@ -10,49 +10,67 @@ internal class MessageBuildersTest {
|
10
|
10
|
private val mockClient = mock<IrcClient>()
|
11
|
11
|
|
12
|
12
|
@Test
|
13
|
|
- fun `CapabilityRequestMessage creates CAP REQ message with single argument`() {
|
|
13
|
+ fun `sendCapabilityRequest sends CAP REQ message with single argument`() {
|
14
|
14
|
mockClient.sendCapabilityRequest(listOf("a"))
|
15
|
15
|
verify(mockClient).send("CAP REQ :a")
|
16
|
16
|
}
|
17
|
17
|
|
18
|
18
|
@Test
|
19
|
|
- fun `CapabilityRequestMessage creates CAP REQ message with multiple args`() {
|
|
19
|
+ fun `sendCapabilityRequest sends CAP REQ message with multiple args`() {
|
20
|
20
|
mockClient.sendCapabilityRequest(listOf("a b c"))
|
21
|
21
|
verify(mockClient).send("CAP REQ :a b c")
|
22
|
22
|
}
|
23
|
23
|
|
24
|
24
|
@Test
|
25
|
|
- fun `JoinMessage creates correct JOIN message`() {
|
|
25
|
+ fun `sendJoin sends correct JOIN message`() {
|
26
|
26
|
mockClient.sendJoin("#TheGibson")
|
27
|
27
|
verify(mockClient).send("JOIN :#TheGibson")
|
28
|
28
|
}
|
29
|
29
|
|
30
|
30
|
@Test
|
31
|
|
- fun `NickMessage creates correct NICK message`() {
|
|
31
|
+ fun `sendNickChange sends correct NICK message`() {
|
32
|
32
|
mockClient.sendNickChange("AcidBurn")
|
33
|
33
|
verify(mockClient).send("NICK :AcidBurn")
|
34
|
34
|
}
|
35
|
35
|
|
36
|
36
|
@Test
|
37
|
|
- fun `PasswordMessage creates correct PASS message`() {
|
|
37
|
+ fun `sendPassword sends correct PASS message`() {
|
38
|
38
|
mockClient.sendPassword("hacktheplanet")
|
39
|
39
|
verify(mockClient).send("PASS :hacktheplanet")
|
40
|
40
|
}
|
41
|
41
|
|
42
|
42
|
@Test
|
43
|
|
- fun `PongMessage creates correct PONG message`() {
|
|
43
|
+ fun `sendPong sends correct PONG message`() {
|
44
|
44
|
mockClient.sendPong("abcdef".toByteArray())
|
45
|
45
|
verify(mockClient).send("PONG :abcdef")
|
46
|
46
|
}
|
47
|
47
|
|
48
|
48
|
@Test
|
49
|
|
- fun `PrivmsgMessage creates correct PRIVMSG message`() {
|
|
49
|
+ fun `sendMessage sends correct PRIVMSG message`() {
|
50
|
50
|
mockClient.sendMessage("acidBurn", "Hack the planet!")
|
51
|
51
|
verify(mockClient).send("PRIVMSG acidBurn :Hack the planet!")
|
52
|
52
|
}
|
53
|
53
|
|
54
|
54
|
@Test
|
55
|
|
- fun `UserMessage creates correct USER message`() {
|
|
55
|
+ fun `sendCtcp sends correct CTCP message with no arguments`() {
|
|
56
|
+ mockClient.sendCtcp("acidBurn", "ping")
|
|
57
|
+ verify(mockClient).send("PRIVMSG acidBurn :\u0001PING\u0001")
|
|
58
|
+ }
|
|
59
|
+
|
|
60
|
+ @Test
|
|
61
|
+ fun `sendCtcp sends correct CTCP message with arguments`() {
|
|
62
|
+ mockClient.sendCtcp("acidBurn", "ping", "12345")
|
|
63
|
+ verify(mockClient).send("PRIVMSG acidBurn :\u0001PING 12345\u0001")
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+ @Test
|
|
67
|
+ fun `sendAction sends correct action`() {
|
|
68
|
+ mockClient.sendAction("acidBurn", "hacks the planet")
|
|
69
|
+ verify(mockClient).send("PRIVMSG acidBurn :\u0001ACTION hacks the planet\u0001")
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ @Test
|
|
73
|
+ fun `sendUser sends correct USER message`() {
|
56
|
74
|
mockClient.sendUser("AcidBurn", "localhost", "gibson", "Kate")
|
57
|
75
|
verify(mockClient).send("USER AcidBurn localhost gibson :Kate")
|
58
|
76
|
}
|