mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-10-13 03:10:34 +00:00
upgrades and filling of README
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import dev.inmo.micro_utils.startup.launcher.Config
|
||||
import dev.inmo.micro_utils.startup.launcher.HelloWorldPlugin
|
||||
import dev.inmo.micro_utils.startup.launcher.defaultJson
|
||||
import dev.inmo.micro_utils.startup.launcher.start
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
import kotlin.test.BeforeTest
|
||||
import kotlin.test.Test
|
||||
|
||||
class StartupLaunchingTests {
|
||||
@BeforeTest
|
||||
fun resetGlobalKoinContext() {
|
||||
runCatching { stopKoin() }
|
||||
}
|
||||
@Test
|
||||
fun CheckThatEmptyPluginsListLeadsToEndOfMain() {
|
||||
val emptyJson = defaultJson.encodeToJsonElement(
|
||||
Config.serializer(),
|
||||
Config(emptyList())
|
||||
).jsonObject
|
||||
|
||||
runTest {
|
||||
val job = launch {
|
||||
start(emptyJson)
|
||||
}
|
||||
job.join()
|
||||
}
|
||||
}
|
||||
@Test
|
||||
fun CheckThatHelloWorldPluginsListLeadsToEndOfMain() {
|
||||
val emptyJson = defaultJson.encodeToJsonElement(
|
||||
Config.serializer(),
|
||||
Config(listOf(HelloWorldPlugin))
|
||||
).jsonObject
|
||||
|
||||
runTest {
|
||||
val job = launch {
|
||||
start(emptyJson)
|
||||
}
|
||||
job.join()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user