30 lines
954 B
Kotlin
30 lines
954 B
Kotlin
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") {
|
|
|
|
it("should populate accounts from config") {
|
|
assertThat(testConfig.accounts).containsExactly(
|
|
Config.Account(
|
|
accountName = "navidrome",
|
|
github = "navidrome/navidrome",
|
|
mastodonInstance = "mastodon.social",
|
|
mastodonAccessToken = "token",
|
|
),
|
|
)
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
})
|