aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-06-23 18:13:52 +0200
committerGitHub <noreply@github.com>2024-06-23 18:13:52 +0200
commitcc291932906c38943e20cee29ee591695a9875b5 (patch)
treeb7290d5ef35cd89fcd8f331ae4d70d0428301b0a /src/test
parent796bdf65f24057d170b91cc043a7fa8e024905ad (diff)
downloadskyhanni-cc291932906c38943e20cee29ee591695a9875b5.tar.gz
skyhanni-cc291932906c38943e20cee29ee591695a9875b5.tar.bz2
skyhanni-cc291932906c38943e20cee29ee591695a9875b5.zip
Backend: Usage of TabWidget (#1240)
Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
index 78304f0ae..d9c31bbff 100644
--- a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
+++ b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.test.garden
-import at.hannibal2.skyhanni.events.TabListUpdateEvent
+import at.hannibal2.skyhanni.data.model.TabWidget
+import at.hannibal2.skyhanni.events.WidgetUpdateEvent
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI
import at.hannibal2.skyhanni.features.garden.visitor.VisitorListener
@@ -33,7 +34,7 @@ class VisitorListenerTest {
@Test
fun `onTablistUpdate it should add new visitors to the list`() {
listener.onTabListUpdate(
- TabListUpdateEvent(
+ fakeTabWidget(
mutableListOf(
"§b§lVisitors: §r§f(3)",
" §r§cSpaceman",
@@ -41,8 +42,8 @@ class VisitorListenerTest {
" §r§fJacob",
"ThePlayerName",
"",
- )
- )
+ ),
+ ),
)
verify { VisitorAPI.addVisitor("§fJacob") }
@@ -57,9 +58,9 @@ class VisitorListenerTest {
)
listener.onTabListUpdate(
- TabListUpdateEvent(
- mutableListOf("§b§lVisitors: §r§f(0)", "")
- )
+ fakeTabWidget(
+ mutableListOf("§b§lVisitors: §r§f(0)", ""),
+ ),
)
verify { VisitorAPI.removeVisitor("§fJacob") }
@@ -74,11 +75,15 @@ class VisitorListenerTest {
every { LorenzUtils.lastWorldSwitch } returns SimpleTimeMark.now()
listener.onTabListUpdate(
- TabListUpdateEvent(
- mutableListOf("§b§lVisitors: §r§f(0)", "")
- )
+ fakeTabWidget(
+ mutableListOf("§b§lVisitors: §r§f(0)", ""),
+ ),
)
verify(exactly = 0) { VisitorAPI.removeVisitor("§fJacob") }
}
+
+ private fun fakeTabWidget(lines: List<String>): WidgetUpdateEvent {
+ return WidgetUpdateEvent(TabWidget.VISITORS, lines)
+ }
}