mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-09-02 14:29:17 +00:00
Compare commits
6 Commits
0.15.1
...
d0eecdead2
| Author | SHA1 | Date | |
|---|---|---|---|
| d0eecdead2 | |||
| cc4a83a033 | |||
| 1cf911bbde | |||
| 36d73d5023 | |||
| c395242e3e | |||
| cd9cd7cc5d |
@@ -13,11 +13,16 @@ kotlin {
|
||||
api internalProject("micro_utils.startup.plugin")
|
||||
}
|
||||
}
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation libs.kt.coroutines.test
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "dev.inmo.micro_utils.startup.launcher.ServerLauncherKt"
|
||||
mainClassName = "dev.inmo.micro_utils.startup.launcher.MainKt"
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -4,32 +4,39 @@ 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 {
|
||||
@Test(timeout = 1000L)
|
||||
@BeforeTest
|
||||
fun resetGlobalKoinContext() {
|
||||
kotlin.runCatching { GlobalContext.stopKoin() }
|
||||
}
|
||||
@Test(timeout = 60000L)
|
||||
fun CheckThatEmptyPluginsListLeadsToEndOfMain() {
|
||||
val emptyJson = defaultJson.encodeToJsonElement(
|
||||
Config.serializer(),
|
||||
Config(emptyList())
|
||||
).jsonObject
|
||||
|
||||
launchSynchronously {
|
||||
runTest {
|
||||
val job = launch {
|
||||
start(emptyJson)
|
||||
}
|
||||
job.join()
|
||||
}
|
||||
}
|
||||
@Test(timeout = 1000L)
|
||||
@Test(timeout = 60000L)
|
||||
fun CheckThatHelloWorldPluginsListLeadsToEndOfMain() {
|
||||
val emptyJson = defaultJson.encodeToJsonElement(
|
||||
Config.serializer(),
|
||||
Config(listOf(HelloWorldPlugin))
|
||||
).jsonObject
|
||||
|
||||
launchSynchronously {
|
||||
runTest {
|
||||
val job = launch {
|
||||
start(emptyJson)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user