mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
Validate several ids in constructors (#336)
* Validate ids in constructors. * Remove redundant `.value` usage in string interpolation. * Make a distinction between `SessionId` and `UserId` in `TestData`.
This commit is contained in:
committed by
GitHub
parent
638b45930e
commit
fae3417181
+2
-2
@@ -36,9 +36,9 @@ open class MessagesStateProvider : PreviewParameterProvider<MessagesState> {
|
||||
}
|
||||
|
||||
fun aMessagesState() = MessagesState(
|
||||
roomId = RoomId("!id"),
|
||||
roomId = RoomId("!id:domain"),
|
||||
roomName = "Room name",
|
||||
roomAvatar = AvatarData("!id", "Room name"),
|
||||
roomAvatar = AvatarData("!id:domain", "Room name"),
|
||||
composerState = aMessageComposerState().copy(
|
||||
text = StableCharSequence("Hello"),
|
||||
isFullScreen = false,
|
||||
|
||||
+4
-3
@@ -28,6 +28,7 @@ import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.timeline.MatrixTimeline
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlin.random.Random
|
||||
|
||||
fun aTimelineState() = TimelineState(
|
||||
timelineItems = persistentListOf(),
|
||||
@@ -78,12 +79,12 @@ internal fun aTimelineItemEvent(
|
||||
content: TimelineItemEventContent = aTimelineItemContent(),
|
||||
groupPosition: TimelineItemGroupPosition = TimelineItemGroupPosition.First
|
||||
): TimelineItem.Event {
|
||||
val randomId = Math.random().toString()
|
||||
val randomId = "\$" + Random.nextInt().toString()
|
||||
return TimelineItem.Event(
|
||||
id = randomId,
|
||||
eventId = EventId(randomId),
|
||||
senderId = UserId("@senderId"),
|
||||
senderAvatar = AvatarData("@senderId", "sender"),
|
||||
senderId = UserId("@senderId:domain"),
|
||||
senderAvatar = AvatarData("@senderId:domain", "sender"),
|
||||
content = content,
|
||||
reactionsState = TimelineItemReactions(
|
||||
persistentListOf(
|
||||
|
||||
Reference in New Issue
Block a user