discord-kagebot/src/test/kotlin/moe/kageru/kagebot/FeatureTest.kt
kageru 7ebafc9958
Completely rewrote config
Added a rawconfig as an intermediate step when parsing the TOML.
This will make nullability much more reliable and also gives me lots of
options in the future. It also broke all tests because reading the
config (not the raw config) now depends on the discord API. :tehe:
2019-06-12 23:43:36 +02:00

45 lines
1.4 KiB
Kotlin

package moe.kageru.kagebot
import io.kotlintest.matchers.string.shouldContain
import io.kotlintest.shouldBe
import io.kotlintest.specs.StringSpec
import io.mockk.every
import io.mockk.mockk
import io.mockk.slot
import org.javacord.api.entity.message.embed.EmbedBuilder
class FeatureTest
/*
class FeatureTest : StringSpec({
"should send welcome" {
val sentMessages = mutableListOf<EmbedBuilder>()
Kagebot.welcomeUser(
mockk {
every { user } returns mockk {
every { id } returns 123
every { sendMessage(capture(sentMessages)) }
}
}
)
sentMessages.size shouldBe 1
TestUtil.embedToString(sentMessages[0]).let { embed ->
Config.config.features!!.welcome!!.content!!.entries.forEach { (title, content) ->
embed shouldContain title
embed shouldContain content
}
}
}
"should send welcome fallback if DMs are disabled" {
val dm = slot<String>()
val sentMessages = mutableListOf<EmbedBuilder>()
TestUtil.prepareServerConfig(sentMessages)
Kagebot.welcomeUser(
mockk {
every { user } returns mockk {
every { id } returns 123
every { sendMessage(capture(dm)) }
}
}
)
}
})
*/