|
@@ -175,4 +175,33 @@ internal class IrcClientImplTest {
|
175
|
175
|
}
|
176
|
176
|
}
|
177
|
177
|
|
|
178
|
+ @Test
|
|
179
|
+ fun `IrcClientImpl sends text to socket`() = runBlocking {
|
|
180
|
+ val client = IrcClientImpl(Server(HOST, PORT), Profile(NICK, REAL_NAME, USER_NAME))
|
|
181
|
+ client.socketFactory = mockSocketFactory
|
|
182
|
+ client.connect()
|
|
183
|
+
|
|
184
|
+ // Wait for it to connect
|
|
185
|
+ verify(mockSocket, timeout(500)).sendLine("CAP LS 302")
|
|
186
|
+
|
|
187
|
+ client.send("testing 123")
|
|
188
|
+
|
|
189
|
+ verify(mockSocket, timeout(500)).sendLine("testing 123")
|
|
190
|
+ }
|
|
191
|
+
|
|
192
|
+ @Test
|
|
193
|
+ fun `IrcClientImpl disconnects the socket`() = runBlocking {
|
|
194
|
+ val client = IrcClientImpl(Server(HOST, PORT), Profile(NICK, REAL_NAME, USER_NAME))
|
|
195
|
+ client.socketFactory = mockSocketFactory
|
|
196
|
+ client.connect()
|
|
197
|
+
|
|
198
|
+ // Wait for it to connect
|
|
199
|
+ verify(mockSocket, timeout(500)).sendLine("CAP LS 302")
|
|
200
|
+
|
|
201
|
+ client.disconnect()
|
|
202
|
+
|
|
203
|
+ verify(mockSocket, timeout(500)).disconnect()
|
|
204
|
+ }
|
|
205
|
+
|
|
206
|
+
|
178
|
207
|
}
|