github-releases-bot/app/src/test/kotlin/de/rpr/githubreleases/ConfigTest.kt

31 lines
954 B
Kotlin
Raw Normal View History

2024-02-12 15:14:59 +01:00
package de.rpr.githubreleases
import assertk.assertThat
import assertk.assertions.containsExactly
import io.kotest.core.spec.style.DescribeSpec
import org.junit.jupiter.api.assertThrows
class ConfigTest : DescribeSpec({
describe("instantiation") {
2024-02-16 10:50:56 +01:00
it("should populate accounts from config") {
assertThat(testConfig.accounts).containsExactly(
Config.Account(
accountName = "navidrome",
github = "navidrome/navidrome",
mastodonInstance = "mastodon.social",
mastodonAccessToken = "token",
),
2024-02-12 15:14:59 +01:00
)
}
2024-02-16 10:50:56 +01:00
}
2024-02-12 15:14:59 +01:00
2024-02-16 10:50:56 +01:00
it("should throw error if account is invalid for repo are not present") {
val configInputStream = Config::class.java.classLoader.getResourceAsStream("invalid-test-config.json")!!
assertThrows<IllegalStateException> {
Config(configInputStream)
2024-02-12 15:14:59 +01:00
}
}
2024-02-16 10:50:56 +01:00
})