mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2024-11-22 07:33:46 +00:00
remove redundant config test and update build workflow
This commit is contained in:
parent
93829d3e0d
commit
6b017c129f
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -8,9 +8,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 1.8
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 11
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
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