Skip to content

Commit 407c07c

Browse files
Added snapshot tests
1 parent 164855f commit 407c07c

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

Sources/StreamChatSwiftUI/ChatChannel/Composer/ImagePickerView.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ struct ImagePickerView: UIViewControllerRepresentable {
2727
func updateUIViewController(
2828
_ uiViewController: UIImagePickerController,
2929
context: Context
30-
) {
31-
// We don't need handling updates of the VC at the moment.
32-
}
30+
) { /* Not needed. */ }
3331

3432
func makeCoordinator() -> ImagePickerCoordinator {
3533
Coordinator(self)

Sources/StreamChatSwiftUI/ChatChannel/Gallery/ShareButtonView.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,5 @@ struct ShareActivityView: UIViewControllerRepresentable {
4949
func updateUIViewController(
5050
_ uiViewController: UIActivityViewController,
5151
context: UIViewControllerRepresentableContext<ShareActivityView>
52-
) {
53-
// We don't need handling updates of the VC at the moment.
54-
}
52+
) { /* Not needed. */ }
5553
}

Sources/StreamChatSwiftUI/ViewModelsFactory.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import StreamChat
77

88
/// Factory used to create view models.
99
public class ViewModelsFactory {
10-
private init() {
11-
// Private init.
12-
}
10+
private init() { /* Private init */ }
1311

1412
/// Creates the `ChannelListViewModel`.
1513
///

StreamChatSwiftUITests/Tests/ChatChannel/MessageView_Tests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,21 @@ class MessageView_Tests: StreamChatTestCase {
260260
// Then
261261
assertSnapshot(matching: view, as: .image)
262262
}
263+
264+
func test_deletedMessageView_snapshot() {
265+
// Given
266+
let message = ChatMessage.mock(
267+
id: .unique,
268+
cid: .unique,
269+
text: "Deleted message",
270+
author: .mock(id: .unique)
271+
)
272+
273+
// When
274+
let view = DeletedMessageView(message: message, isFirst: true)
275+
.applyDefaultSize()
276+
277+
// Then
278+
assertSnapshot(matching: view, as: .image)
279+
}
263280
}
54.3 KB
Loading

0 commit comments

Comments
 (0)