aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
blob: dbce76217f42b9918defbd3506247d88df397b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
import kotlin.time.Duration.Companion.seconds
import net.minecraft.text.Text
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.AbilityUtils
import moe.nea.firmament.util.unformattedString

class AbilityUtilsTest : AnnotationSpec() {

	fun List<AbilityUtils.ItemAbility>.stripDescriptions() = map {
		it.copy(descriptionLines = it.descriptionLines.map { Text.literal(it.unformattedString) })
	}

	@Test
	fun testUnpoweredDrill() {
		Assertions.assertEquals(
			listOf(
				AbilityUtils.ItemAbility(
					"Pickobulus",
					false,
					AbilityUtils.AbilityActivation.RIGHT_CLICK,
					null,
					listOf("Throw your pickaxe to create an",
					       "explosion mining all ores in a 3 block",
					       "radius.").map(Text::literal),
					48.seconds
				)
			),
			AbilityUtils.getAbilities(ItemResources.loadItem("titanium-drill")).stripDescriptions()
		)
	}

	@Test
	fun testPoweredPickaxe() {
		Assertions.assertEquals(
			listOf(
				AbilityUtils.ItemAbility(
					"Mining Speed Boost",
					true,
					AbilityUtils.AbilityActivation.RIGHT_CLICK,
					null,
					listOf("Grants +200% ⸕ Mining Speed for",
					       "10s.").map(Text::literal),
					2.minutes
				)
			),
			AbilityUtils.getAbilities(ItemResources.loadItem("diamond-pickaxe")).stripDescriptions()
		)
	}

	@Test
	fun testAOTV() {
		Assertions.assertEquals(
			listOf(
				AbilityUtils.ItemAbility(
					"Instant Transmission", true, AbilityUtils.AbilityActivation.RIGHT_CLICK, 23,
					listOf("Teleport 12 blocks ahead of you and",
					       "gain +50 ✦ Speed for 3 seconds.").map(Text::literal),
					null
				),
				AbilityUtils.ItemAbility(
					"Ether Transmission",
					false,
					AbilityUtils.AbilityActivation.SNEAK_RIGHT_CLICK,
					90,
					listOf("Teleport to your targeted block up",
					       "to 61 blocks away.",
					       "Soulflow Cost: 1").map(Text::literal),
					null
				)
			),
			AbilityUtils.getAbilities(ItemResources.loadItem("aspect-of-the-void")).stripDescriptions()
		)
	}
}