You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PrivmsgProcessorTest.kt 1.1KB

12345678910111213141516171819202122232425
  1. package com.dmdirc.ktirc.messages
  2. import com.dmdirc.ktirc.events.MessageReceived
  3. import com.dmdirc.ktirc.model.IrcMessage
  4. import com.dmdirc.ktirc.model.User
  5. import org.junit.jupiter.api.Assertions
  6. import org.junit.jupiter.api.Test
  7. internal class PrivmsgProcessorTest {
  8. @Test
  9. fun `PrivsgProcessor raises message received event`() {
  10. val events = PrivmsgProcessor().process(
  11. IrcMessage(emptyMap(), "acidburn!libby@root.localhost".toByteArray(), "PRIVMSG", listOf("#crashandburn".toByteArray(), "hack the planet!".toByteArray())))
  12. Assertions.assertEquals(1, events.size)
  13. Assertions.assertEquals(MessageReceived(User("acidburn", "libby", "root.localhost"), "#crashandburn", "hack the planet!"), events[0])
  14. }
  15. @Test
  16. fun `PrivsgProcessor does nothing if prefix missing`() {
  17. val events = PrivmsgProcessor().process(
  18. IrcMessage(emptyMap(), null, "PRIVMSG", listOf("#crashandburn".toByteArray(), "hack the planet!".toByteArray())))
  19. Assertions.assertEquals(0, events.size)
  20. }
  21. }