-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added channel attach room lifecycle spec CHA-RL1f, CHA-RL1g, updated
testhelpers for the same
- Loading branch information
Showing
4 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
chat-android/src/test/java/com/ably/helpers/RoomLifecycleManagerExtensions.kt
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
chat-android/src/test/java/com/ably/utils/RoomLifecycleManagerTestHelpers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.ably.utils | ||
|
||
import com.ably.chat.AtomicCoroutineScope | ||
import com.ably.chat.ChatApi | ||
import com.ably.chat.DefaultMessages | ||
import com.ably.chat.DefaultOccupancy | ||
import com.ably.chat.DefaultPresence | ||
import com.ably.chat.DefaultRoomReactions | ||
import com.ably.chat.DefaultTyping | ||
import com.ably.chat.ResolvedContributor | ||
import com.ably.chat.RoomLifecycleManager | ||
import com.ably.chat.getPrivateField | ||
import io.ably.lib.realtime.AblyRealtime | ||
import io.ably.lib.types.ClientOptions | ||
import io.mockk.mockk | ||
import io.mockk.spyk | ||
|
||
fun RoomLifecycleManager.atomicCoroutineScope(): AtomicCoroutineScope { | ||
return getPrivateField("atomicCoroutineScope") | ||
} | ||
|
||
fun createRoomFeatureMocks(roomId: String = "1234"): List<ResolvedContributor> { | ||
val realtimeClient = spyk(AblyRealtime(ClientOptions("id:key").apply { autoConnect = false })) | ||
val chatApi = mockk<ChatApi>(relaxed = true) | ||
|
||
val messagesContributor = spyk(DefaultMessages(roomId, realtimeClient.channels, chatApi), recordPrivateCalls = true) | ||
val presenceContributor = spyk(DefaultPresence(messagesContributor), recordPrivateCalls = true) | ||
val occupancyContributor = spyk(DefaultOccupancy(messagesContributor), recordPrivateCalls = true) | ||
val typingContributor = spyk(DefaultTyping(roomId, realtimeClient), recordPrivateCalls = true) | ||
val reactionsContributor = spyk(DefaultRoomReactions(roomId, realtimeClient), recordPrivateCalls = true) | ||
return listOf(messagesContributor, presenceContributor, occupancyContributor, typingContributor, reactionsContributor) | ||
} |