From cc291932906c38943e20cee29ee591695a9875b5 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sun, 23 Jun 2024 18:13:52 +0200 Subject: Backend: Usage of TabWidget (#1240) Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/test/garden/VisitorListenerTest.kt | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/test/java/at/hannibal2/skyhanni') 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): WidgetUpdateEvent { + return WidgetUpdateEvent(TabWidget.VISITORS, lines) + } } -- cgit