remove redundant config test and update build workflow

This commit is contained in:
InsanusMokrassar 2022-05-16 14:12:56 -04:00
parent 93829d3e0d
commit 6b017c129f
2 changed files with 2 additions and 42 deletions

View File

@ -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

View File

@ -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())
}
}