aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-27 16:04:05 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-27 16:05:19 +0100
commitee0526ac67e093f77d17747d9316765b2db272a2 (patch)
tree1e2f8a26475afcc8c0d36b85068e1a2b282410ab /src/test/kotlin
parent9df1f12970dafdbf4cb13c76c1df1caed66f4a59 (diff)
downloadFirmament-ee0526ac67e093f77d17747d9316765b2db272a2.tar.gz
Firmament-ee0526ac67e093f77d17747d9316765b2db272a2.tar.bz2
Firmament-ee0526ac67e093f77d17747d9316765b2db272a2.zip
test: Use kotest
Diffstat (limited to 'src/test/kotlin')
-rw-r--r--src/test/kotlin/testutil/KotestPlugin.kt16
-rw-r--r--src/test/kotlin/util/ColorCodeTest.kt26
-rw-r--r--src/test/kotlin/util/TextUtilText.kt6
-rw-r--r--src/test/kotlin/util/skyblock/AbilityUtilsTest.kt3
-rw-r--r--src/test/kotlin/util/skyblock/SackUtilTest.kt3
5 files changed, 36 insertions, 18 deletions
diff --git a/src/test/kotlin/testutil/KotestPlugin.kt b/src/test/kotlin/testutil/KotestPlugin.kt
new file mode 100644
index 0000000..6db50fb
--- /dev/null
+++ b/src/test/kotlin/testutil/KotestPlugin.kt
@@ -0,0 +1,16 @@
+package moe.nea.firmament.test.testutil
+
+import io.kotest.core.config.AbstractProjectConfig
+import io.kotest.core.extensions.Extension
+import moe.nea.firmament.test.FirmTestBootstrap
+
+class KotestPlugin : AbstractProjectConfig() {
+ override fun extensions(): List<Extension> {
+ return listOf()
+ }
+
+ override suspend fun beforeProject() {
+ FirmTestBootstrap.bootstrapMinecraft()
+ super.beforeProject()
+ }
+}
diff --git a/src/test/kotlin/util/ColorCodeTest.kt b/src/test/kotlin/util/ColorCodeTest.kt
index d9de36a..949749e 100644
--- a/src/test/kotlin/util/ColorCodeTest.kt
+++ b/src/test/kotlin/util/ColorCodeTest.kt
@@ -1,25 +1,23 @@
package moe.nea.firmament.test.util
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
-import org.junit.jupiter.api.Test
-import net.minecraft.Bootstrap
-import net.minecraft.SharedConstants
import moe.nea.firmament.util.removeColorCodes
-class ColorCodeTest {
+class ColorCodeTest : AnnotationSpec() {
@Test
fun testWhatever() {
- Assertions.assertEquals("", "".removeColorCodes().toString())
- Assertions.assertEquals("", "§".removeColorCodes().toString())
- Assertions.assertEquals("", "§a".removeColorCodes().toString())
- Assertions.assertEquals("ab", "a§ab".removeColorCodes().toString())
- Assertions.assertEquals("ab", "a§ab§§".removeColorCodes().toString())
- Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes().toString())
- Assertions.assertEquals("bc", "§ab§§c".removeColorCodes().toString())
- Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true).toString())
- Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true).toString())
- Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true).toString())
+ Assertions.assertEquals("", "".removeColorCodes())
+ Assertions.assertEquals("", "§".removeColorCodes())
+ Assertions.assertEquals("", "§a".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab§§".removeColorCodes())
+ Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes())
+ Assertions.assertEquals("bc", "§ab§§c".removeColorCodes())
+ Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true))
+ Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true))
+ Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true))
}
@Test
diff --git a/src/test/kotlin/util/TextUtilText.kt b/src/test/kotlin/util/TextUtilText.kt
index 7091f4e..e676d63 100644
--- a/src/test/kotlin/util/TextUtilText.kt
+++ b/src/test/kotlin/util/TextUtilText.kt
@@ -1,15 +1,17 @@
package moe.nea.firmament.test.util
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.getLegacyFormatString
-class TextUtilText {
+class TextUtilText : AnnotationSpec() {
@Test
fun testThing() {
// TODO: add more tests that are directly validated with 1.8.9 code
val text = ItemResources.loadText("all-chat")
- Assertions.assertEquals("§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r", text.getLegacyFormatString())
+ Assertions.assertEquals("§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r",
+ text.getLegacyFormatString())
}
}
diff --git a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
index abe739d..dbce762 100644
--- a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
+++ b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.test.util.skyblock
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import kotlin.time.Duration.Companion.minutes
@@ -9,7 +10,7 @@ import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.AbilityUtils
import moe.nea.firmament.util.unformattedString
-class AbilityUtilsTest {
+class AbilityUtilsTest : AnnotationSpec() {
fun List<AbilityUtils.ItemAbility>.stripDescriptions() = map {
it.copy(descriptionLines = it.descriptionLines.map { Text.literal(it.unformattedString) })
diff --git a/src/test/kotlin/util/skyblock/SackUtilTest.kt b/src/test/kotlin/util/skyblock/SackUtilTest.kt
index e0e3e63..e1b106e 100644
--- a/src/test/kotlin/util/skyblock/SackUtilTest.kt
+++ b/src/test/kotlin/util/skyblock/SackUtilTest.kt
@@ -1,12 +1,13 @@
package moe.nea.firmament.test.util.skyblock
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.SackUtil
import moe.nea.firmament.util.skyblock.SkyBlockItems
-class SackUtilTest {
+class SackUtilTest : AnnotationSpec() {
@Test
fun testOneRottenFlesh() {
Assertions.assertEquals(