mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2024-11-14 03:43:47 +00:00
remove redundant config test and update build workflow
This commit is contained in:
parent
8aaaa86dd4
commit
d6770e1c02
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -8,9 +8,9 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 11
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
@ -1,40 +0,0 @@
|
||||
package dev.inmo.plagubot.config
|
||||
|
||||
import dev.inmo.plagubot.HelloPlugin
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class ConfigTest {
|
||||
@InternalSerializationApi
|
||||
@Test
|
||||
fun testThatPluginPassedToParamsWillBeCorrectlyUsedInPlugins() {
|
||||
val rawConfig = """
|
||||
{
|
||||
"database": {
|
||||
},
|
||||
"botToken": "",
|
||||
"plugins": [
|
||||
"helloPlugin"
|
||||
],
|
||||
"params": {
|
||||
"helloPlugin": {"type": "dev.inmo.plagubot.HelloPlugin", "parameter": "Example"}
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
val config = configAndPluginsConfigJsonFormat.decodeFromString(PluginsConfigurationSerializer, rawConfig) as Config
|
||||
|
||||
assert(config.plugins.size == 1)
|
||||
assert(config.plugins.first() is HelloPlugin)
|
||||
assert((config.plugins.first() as HelloPlugin).parameter == "Example")
|
||||
|
||||
val redecoded = configAndPluginsConfigJsonFormat.decodeFromString(
|
||||
PluginsConfigurationSerializer,
|
||||
configAndPluginsConfigJsonFormat.encodeToString(PluginsConfigurationSerializer, config)
|
||||
) as Config
|
||||
assertEquals(config.databaseConfig, redecoded.databaseConfig)
|
||||
assertEquals(config.plugins, redecoded.plugins)
|
||||
assertEquals(config.botToken, redecoded.botToken)
|
||||
assertEquals(config.params ?.toMap(), redecoded.params ?.toMap())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user