fixes in StartupLauncingTests

This commit is contained in:
InsanusMokrassar 2022-12-07 10:50:51 +06:00
parent cd9cd7cc5d
commit c395242e3e
2 changed files with 14 additions and 2 deletions

View File

@ -13,6 +13,11 @@ kotlin {
api internalProject("micro_utils.startup.plugin")
}
}
jvmTest {
dependencies {
implementation libs.kt.coroutines.test
}
}
}
}

View File

@ -4,10 +4,17 @@ 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 org.koin.core.context.GlobalContext
import kotlin.test.BeforeTest
import kotlin.test.Test
class StartupLaunchingTests {
@BeforeTest
fun resetGlobalKoinContext() {
kotlin.runCatching { GlobalContext.stopKoin() }
}
@Test(timeout = 1000L)
fun CheckThatEmptyPluginsListLeadsToEndOfMain() {
val emptyJson = defaultJson.encodeToJsonElement(
@ -15,7 +22,7 @@ class StartupLaunchingTests {
Config(emptyList())
).jsonObject
launchSynchronously {
runTest {
val job = launch {
start(emptyJson)
}
@ -29,7 +36,7 @@ class StartupLaunchingTests {
Config(listOf(HelloWorldPlugin))
).jsonObject
launchSynchronously {
runTest {
val job = launch {
start(emptyJson)
}