mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-17 22:03:50 +00:00
fixes in StartupLauncingTests
This commit is contained in:
parent
cd9cd7cc5d
commit
c395242e3e
@ -13,6 +13,11 @@ kotlin {
|
|||||||
api internalProject("micro_utils.startup.plugin")
|
api internalProject("micro_utils.startup.plugin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jvmTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kt.coroutines.test
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.defaultJson
|
||||||
import dev.inmo.micro_utils.startup.launcher.start
|
import dev.inmo.micro_utils.startup.launcher.start
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.test.runTest
|
||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import org.koin.core.context.GlobalContext
|
||||||
|
import kotlin.test.BeforeTest
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
class StartupLaunchingTests {
|
class StartupLaunchingTests {
|
||||||
|
@BeforeTest
|
||||||
|
fun resetGlobalKoinContext() {
|
||||||
|
kotlin.runCatching { GlobalContext.stopKoin() }
|
||||||
|
}
|
||||||
@Test(timeout = 1000L)
|
@Test(timeout = 1000L)
|
||||||
fun CheckThatEmptyPluginsListLeadsToEndOfMain() {
|
fun CheckThatEmptyPluginsListLeadsToEndOfMain() {
|
||||||
val emptyJson = defaultJson.encodeToJsonElement(
|
val emptyJson = defaultJson.encodeToJsonElement(
|
||||||
@ -15,7 +22,7 @@ class StartupLaunchingTests {
|
|||||||
Config(emptyList())
|
Config(emptyList())
|
||||||
).jsonObject
|
).jsonObject
|
||||||
|
|
||||||
launchSynchronously {
|
runTest {
|
||||||
val job = launch {
|
val job = launch {
|
||||||
start(emptyJson)
|
start(emptyJson)
|
||||||
}
|
}
|
||||||
@ -29,7 +36,7 @@ class StartupLaunchingTests {
|
|||||||
Config(listOf(HelloWorldPlugin))
|
Config(listOf(HelloWorldPlugin))
|
||||||
).jsonObject
|
).jsonObject
|
||||||
|
|
||||||
launchSynchronously {
|
runTest {
|
||||||
val job = launch {
|
val job = launch {
|
||||||
start(emptyJson)
|
start(emptyJson)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user