Add logback extensions, coloured output, toggleable logging in IRCClient
This commit is contained in:
@@ -4,7 +4,7 @@ import com.shr4pnel.ferretirc.net.messages.ServerMessage
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -20,7 +20,7 @@ class IrcClientTest {
|
||||
|
||||
companion object {
|
||||
lateinit var processes: MutableList<Process>
|
||||
val client = IrcClient("localhost", 6667)
|
||||
val client = IrcClient("localhost", 6667, enableLogging = true)
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
@JvmStatic
|
||||
@@ -42,7 +42,10 @@ class IrcClientTest {
|
||||
),
|
||||
)
|
||||
client.connect()
|
||||
client.register("shr4p", "Tyler D", "password")
|
||||
client.register("shr4p", "Tyler Fullname", "password")
|
||||
guestUser.connect()
|
||||
guestUser.register("guest", "guest", "pass")
|
||||
client.server
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -103,10 +106,7 @@ class IrcClientTest {
|
||||
|
||||
@Test
|
||||
fun messageLands() =
|
||||
runBlocking {
|
||||
val guestUser = IrcClient("localhost", 6667, false)
|
||||
guestUser.connect()
|
||||
guestUser.register("guest", "guest", "pass")
|
||||
runTest {
|
||||
val channels = client.server.fetchChannels()
|
||||
val message = Message.PrivMsg(channels.first(), "bring me to life")
|
||||
guestUser.queueMessage(message)
|
||||
|
||||
Reference in New Issue
Block a user