diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift index ac57ae3d..e4e43f18 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelViewModel_Tests.swift @@ -455,6 +455,20 @@ class ChatChannelViewModel_Tests: StreamChatTestCase { // Then XCTAssert(shouldJump == false) } + + func test_chatChannelVM_jumpToUnknownMessage() { + // Given + let message1 = ChatMessage.mock() + let message2 = ChatMessage.mock() + let channelController = makeChannelController(messages: [message1, message2]) + let viewModel = ChatChannelViewModel(channelController: channelController) + + // When + let shouldJump = viewModel.jumpToMessage(messageId: .unknownMessageId) + + // Then + XCTAssert(shouldJump == false) + } // MARK: - private diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift index a2bd714a..d7634021 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageActions_Tests.swift @@ -68,7 +68,7 @@ class MessageActions_Tests: StreamChatTestCase { XCTAssert(messageActions[1].title == "Thread Reply") XCTAssert(messageActions[2].title == "Pin to conversation") XCTAssert(messageActions[3].title == "Copy Message") - XCTAssert(messageActions[4].title == "Mark Unread") + XCTAssert(messageActions[4].title == "Mark Unread") XCTAssert(messageActions[5].title == "Flag Message") XCTAssert(messageActions[6].title == "Mute User") } diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/MessageListView_Tests.swift b/StreamChatSwiftUITests/Tests/ChatChannel/MessageListView_Tests.swift index 10616fd5..24defddb 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannel/MessageListView_Tests.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannel/MessageListView_Tests.swift @@ -75,17 +75,32 @@ class MessageListView_Tests: StreamChatTestCase { // Then assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) } + + func test_messageListView_jumpToUnreadButton() { + // Given + let channelConfig = ChannelConfig(reactionsEnabled: true) + let view = makeMessageListView( + channelConfig: channelConfig, + unreadCount: .mock(messages: 3) + ) + .applyDefaultSize() + + // Then + assertSnapshot(matching: view, as: .image(perceptualPrecision: precision)) + } // MARK: - private func makeMessageListView( channelConfig: ChannelConfig, + unreadCount: ChannelUnreadCount = .noUnread, currentlyTypingUsers: Set = [] ) -> MessageListView { let reactions = [MessageReactionType(rawValue: "like"): 2] let channel = ChatChannel.mockDMChannel( config: channelConfig, - currentlyTypingUsers: currentlyTypingUsers + currentlyTypingUsers: currentlyTypingUsers, + unreadCount: unreadCount ) let temp = [ChatMessage.mock( id: .unique, diff --git a/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageListView_Tests/test_messageListView_jumpToUnreadButton.1.png b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageListView_Tests/test_messageListView_jumpToUnreadButton.1.png new file mode 100644 index 00000000..44f3f7b1 Binary files /dev/null and b/StreamChatSwiftUITests/Tests/ChatChannel/__Snapshots__/MessageListView_Tests/test_messageListView_jumpToUnreadButton.1.png differ