|
@@ -239,4 +239,34 @@ internal class UserStateHandlerTest {
|
239
|
239
|
assertEquals("root.gibson", fakeUserState["acidBurn"]?.details?.hostname)
|
240
|
240
|
}
|
241
|
241
|
|
|
242
|
+ @Test
|
|
243
|
+ fun `updates details for user back events`() {
|
|
244
|
+ val user = User("acidBurn", "libby", "root.localhost")
|
|
245
|
+ fakeUserState += User("AcidBurn", awayMessage = "Hacking the planet")
|
|
246
|
+
|
|
247
|
+ handler.processEvent(ircClient, UserAway(EventMetadata(TestConstants.time), user, null))
|
|
248
|
+
|
|
249
|
+ assertNull(fakeUserState["acidBurn"]?.details?.awayMessage)
|
|
250
|
+ }
|
|
251
|
+
|
|
252
|
+ @Test
|
|
253
|
+ fun `does not update away details for less detailed events`() {
|
|
254
|
+ val user = User("acidBurn", "libby", "root.localhost")
|
|
255
|
+ fakeUserState += User("AcidBurn", awayMessage = "Hacking the planet")
|
|
256
|
+
|
|
257
|
+ handler.processEvent(ircClient, UserAway(EventMetadata(TestConstants.time), user, ""))
|
|
258
|
+
|
|
259
|
+ assertEquals("Hacking the planet", fakeUserState["acidBurn"]?.details?.awayMessage)
|
|
260
|
+ }
|
|
261
|
+
|
|
262
|
+ @Test
|
|
263
|
+ fun `updates away details for away message`() {
|
|
264
|
+ val user = User("acidBurn", "libby", "root.localhost")
|
|
265
|
+ fakeUserState += User("AcidBurn")
|
|
266
|
+
|
|
267
|
+ handler.processEvent(ircClient, UserAway(EventMetadata(TestConstants.time), user, "Hacking the planet"))
|
|
268
|
+
|
|
269
|
+ assertEquals("Hacking the planet", fakeUserState["acidBurn"]?.details?.awayMessage)
|
|
270
|
+ }
|
|
271
|
+
|
242
|
272
|
}
|