Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import io.getstream.feeds.android.client.api.model.PaginationData
import io.getstream.feeds.android.client.api.model.ThreadedCommentData
import io.getstream.feeds.android.client.api.state.query.CommentRepliesQuery
import io.getstream.feeds.android.client.internal.model.PaginationResult
import io.getstream.feeds.android.client.internal.model.addReply
import io.getstream.feeds.android.client.internal.model.removeReaction
import io.getstream.feeds.android.client.internal.model.upsertReaction
import io.getstream.feeds.android.client.internal.test.TestData.commentData
Expand Down Expand Up @@ -75,9 +76,10 @@ internal class CommentReplyListStateImplTest {
val newReply =
threadedCommentData("reply-1", parentId = "parent-1", text = "Reply to parent")

val expectedParent = parentComment.addReply(newReply, Comparator { _, _ -> 0 })

state.onCommentAdded(newReply)

val expectedParent = parentComment.copy(replies = listOf(newReply), replyCount = 1)
Comment on lines +79 to -80
Copy link
Contributor

@gpunto gpunto Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using production code to build the expected result, we usually favor stating it explicitly. Otherwise, if the addReply function has a bug, we would not catch it. This is why replies and replyCount were set explicitly.

Copy link
Contributor Author

@kanake10 kanake10 Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, will close this PR

assertEquals(listOf(expectedParent), state.replies.value)
}

Expand Down
Loading