summaryrefslogtreecommitdiff
path: root/platform-paper/src/test
diff options
context:
space:
mode:
authorSho Sakuma <me@m1sk9.dev>2026-03-18 13:45:01 +0900
committerSho Sakuma <me@m1sk9.dev>2026-03-18 13:45:01 +0900
commit2be902e6858d59bf02aa72a6702e55e6b371fbc9 (patch)
tree396fb7865de65e806faef63339b4c112131b0fb1 /platform-paper/src/test
parentbed6a970165d6aa70473df842606d5f8ed1897e7 (diff)
downloadLunaticChat-2be902e6858d59bf02aa72a6702e55e6b371fbc9.tar.gz
LunaticChat-2be902e6858d59bf02aa72a6702e55e6b371fbc9.tar.bz2
LunaticChat-2be902e6858d59bf02aa72a6702e55e6b371fbc9.zip
test: Add test-case, ignore listener
Diffstat (limited to 'platform-paper/src/test')
-rw-r--r--platform-paper/src/test/kotlin/dev/m1sk9/lunaticChat/paper/chat/channel/ChannelManagerTest.kt31
1 files changed, 31 insertions, 0 deletions
diff --git a/platform-paper/src/test/kotlin/dev/m1sk9/lunaticChat/paper/chat/channel/ChannelManagerTest.kt b/platform-paper/src/test/kotlin/dev/m1sk9/lunaticChat/paper/chat/channel/ChannelManagerTest.kt
index 8174a33..239da52 100644
--- a/platform-paper/src/test/kotlin/dev/m1sk9/lunaticChat/paper/chat/channel/ChannelManagerTest.kt
+++ b/platform-paper/src/test/kotlin/dev/m1sk9/lunaticChat/paper/chat/channel/ChannelManagerTest.kt
@@ -547,6 +547,37 @@ class ChannelManagerTest {
}
@Test
+ fun `restorePlayerChannel should select most recently joined channel`() {
+ val memberId = createTestUUID(3)
+ val oldMember =
+ ChannelMember(channelId = "old-ch", playerId = memberId, role = ChannelRole.MEMBER, joinedAt = 1000L)
+ val newMember =
+ ChannelMember(channelId = "new-ch", playerId = memberId, role = ChannelRole.MEMBER, joinedAt = 2000L)
+ val owner1 = createTestUUID(1)
+ val owner2 = createTestUUID(2)
+ val oldChannel = createTestChannel(id = "old-ch", name = "Old Channel", ownerId = owner1)
+ val newChannel = createTestChannel(id = "new-ch", name = "New Channel", ownerId = owner2)
+
+ val data =
+ ChannelData(
+ channels = mapOf("old-ch" to oldChannel, "new-ch" to newChannel),
+ members =
+ mapOf(
+ "old-ch" to listOf(oldMember),
+ "new-ch" to listOf(newMember),
+ ),
+ )
+
+ val (manager, _, _) = createManager(initialData = data)
+ manager.initialize()
+
+ // Should restore to the most recently joined channel
+ val context = manager.restorePlayerChannel(memberId)
+ assertNotNull(context)
+ assertEquals("new-ch", context.channelId)
+ }
+
+ @Test
fun `saveToDisk should call storage saveToDisk`() {
val (manager, storage, _) = createManager()
manager.initialize()